in reply to Re: strange shift @_ problem
in thread strange shift @_ problem

Thanks, but it doesn't help ;)))

Because it DOES work the way it is written,
and the way you write it, it tries to use the string
as the first index of the slice on the thing ;)))

ahunter had a great point there...

but.. This IS the first time Perl does something I DON'T
expect ;))

GreetZ!,

print "profeth still\n" if /bird|devil/;

Replies are listed 'Best First'.
Re: strange shift @_ problem
by flocto (Pilgrim) on Jan 18, 2001 at 17:18 UTC
    Hm, I think I see now what you mean. You can access $_2 in that line I posted but not after that line was processed.
    AFAIK, perl replaces all variables first (like $_2) and then processes the commands (like shift). That would result in:
    First $_2 was replaced with it's value (3 or 5 or whatever), and then perl uses the shift command and there is no $_2 no more..
    Maybe that helps!?

    Regards, octopus
    --
    GED/CC d-- s:- a--- C++(+++) UL+++ P++++$ L++>++++ E--- W+++@ N o? K? w-- O- M-(+) V? !PS !PE !Y PGP+(++) t-- 5 X+ R+(+++) tv+(++) b++@ DI+() D+ G++ e->+++ h!++ r+(++) y+