Created
December 16, 2011 07:43
-
-
Save riywo/1484992 to your computer and use it in GitHub Desktop.
wantarrayはこんな感じで連鎖できる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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