in reply to Re^2: Can we do without auxiliary variable here?
in thread Can we do without auxiliary variable here?

chromatic:

Ha, ha! It never occurred to me!

#!/usr/bin/perl use strict; use warnings; my $prefix="Prefix: "; sub print_prefix { print $prefix, @_; } print_prefix "alpha ", "beta ", "gamma\n";

Sigh. When I read your reply, I thought, "Hmm, does unshift return a reference to the array?", so a first I thought you were prompting me to do something like:

print unshift @_, $prefix;

But when I checked the docs, I could see that it wouldn't fly. Then I understood what you meant. Ah, well! I'm always amused at how my mind works: it seems I frequently complicate simple things. ;^)

...roboticus

When your only tool is a hammer, all problems look like your thumb.