Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

hashes

By: a guest on Mar 28th, 2013  |  syntax: Perl  |  size: 0.34 KB  |  hits: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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);