Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://504200]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-26 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found