SHARE
TWEET

hashes

a guest Mar 28th, 2013 44 Never
  1. use strict;
  2. use Data::Dumper;
  3. my $test = "hello world";
  4. my %frags = ();
  5. if($test =~ m/(\w+)\s(\w+)/g) {
  6.             %frags = (
  7.                     'a' => $1,
  8.                     'b' => $2);
  9.     }
  10. print Dumper(\%frags);
  11. my @sexy_array;
  12. foreach my $key (keys %frags) {
  13.         push(@sexy_array, $frags{$key});
  14. }
  15. print Dumper(\@sexy_array);
RAW Paste Data
Top