Skip to content

Instantly share code, notes, and snippets.

@oogatta
Created July 20, 2012 10:12
Show Gist options
  • Save oogatta/3149996 to your computer and use it in GitHub Desktop.
Save oogatta/3149996 to your computer and use it in GitHub Desktop.
perl hash slice
#!/usr/bin/perl
use strict;
use warnings;
my %testhash = (
test => 1,
hoge => 2,
fuga => 3,
);
# 5.8.9:○ / 5.10.1:×
eval {
print @{%testhash}{qw/test hoge fuga/};
print "\n";
};
# 5.8.9:○ / 5.10.1:○
eval {
print @testhash{qw/fuga hoge test/};
print "\n";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment