http://www.perlmonks.org?node_id=504200


in reply to Perl packages to convert hash refs to array refs and vice-versa?

Using a module for that strikes me as overkill...

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; # Create an array reference to demo this my $foo_ref = ['a', 'b', 'c', 'd']; # Convert array ref into hash ref and display my $bar_ref = {@{$foo_ref}}; print Dumper $bar_ref; # Convert hash ref into array ref and display my $new_foo_ref = [%{$bar_ref}]; print Dumper $new_foo_ref;
  • Comment on Re: Perl packages to convert hash refs to array refs and vice-versa?
  • Download Code