Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl packages to convert hash refs to array refs and vice-versa?

by dorward (Curate)
on Oct 31, 2005 at 09:37 UTC ( #504200=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504200]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-12-01 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (7 votes). Check out past polls.

    Notices?