APM: shift question

Philip Molter hrunting at texas.net
Sun Oct 20 00:15:18 CDT 2002


On Sat, 19 Oct 2002, Goldilox wrote:

: In my script, how would I print out the element shaved off by
: 
: shift @directories

  print shift @directories;

If you need to save that variable for some reason (like, to use it in
multiple print statements), do the Right Thing(tm) and stick it in a
lexical:

  my $var = shift @directories;
  print $var, "\n";
  print $var, " again\n";

It's bad form (not illegal, just bad) to use $_ for anything more than
the most trivial.  Since you're having problems with it, I'd just drop
it altogether.  No one will ever think less of you for not using $_.





More information about the Austin mailing list