Skip to content

Instantly share code, notes, and snippets.

@riywo
Created December 16, 2011 07:43
Show Gist options
  • Save riywo/1484992 to your computer and use it in GitHub Desktop.
Save riywo/1484992 to your computer and use it in GitHub Desktop.
wantarrayはこんな感じで連鎖できる
use strict;
use warnings;
sub hoge { return fuga() };
sub fuga {
if (wantarray) {
print "array\n";
} else {
print "scalar\n";
}
};
my $hoge = hoge();
my @hoge = hoge();
__END__
scalar
array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment