On Thu, Sep 22, 2011 at 11:09 AM, John W. Krahn <jwkr...@shaw.ca> wrote: > Brandon McCaig wrote: >> open @_ or die "Can't open '$filename': $!"; > > That won't work as the first argument to open is forced into scalar context > > $ perl -le'print prototype "CORE::open"' > *;$@ > > so if @_ contains three elements that becomes: > > open 3 or die "Can't open '$filename': $!";
I didn't think of that. Still, you could pass them directly on with $_[0], $_[1], and $_[2] (so at least the alias to $_[0] is intact, though admittedly I know very little of how aliases work in Perl). :\ > And why is $filename not passed into the subroutine? An oversight on my part. :) That's what happens when you don't test the code. ;) Should have been $_[2]. -- Brandon McCaig <http://www.bamccaig.com/> <bamcc...@gmail.com> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl. Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/