Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Ok, here's a really weird one that I can't figure out for the life of me. I've got a scaler called $rest. The last element(word) in $rest is supposed to be a password, whether $rest is 1 element or 432678 elements.
After reading up, I found the sexy pop function.. but since it only works on array's I did a little diddling with $rest
so that it would be in array form to use pop. well, straightforward,(@rest = split(/ /, $rest);
doesn't work, I$apass = pop @rest;
and get nothing at all. I thought perhaps maybe I was just a really bad coder and $rest or @rest was empty, but I canprint "ATTEMPT PASS: $apass\n";
andprint "\$REST: $rest\n";
and I get data everytime! (the correct data!)foreach $i @rest { print "\@REST: $i\n";
So I did more looking and saw that pop @rest; should return $_, so I
and get NO data other than my "$_" literal...print "\$_: $_\n";
I'm SO stumped on this, it isnt even funny. Thanks for the help! Terron the lamer
Edit: chipmunk 2001-07-12
Edit: neophyte 2001-07-13 for better readability
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unGodly problems with pop()
by bikeNomad (Priest) on Jul 13, 2001 at 05:57 UTC | |
|
Re (tilly) 1: unGodly problems with pop()
by tilly (Archbishop) on Jul 13, 2001 at 05:59 UTC | |
|
Re: unGodly problems with pop()
by synapse0 (Pilgrim) on Jul 13, 2001 at 06:22 UTC | |
|
(Fixed) Re: unGodly problems with pop()
by Anonymous Monk on Jul 13, 2001 at 06:57 UTC | |
by dragonchild (Archbishop) on Jul 13, 2001 at 16:23 UTC | |
by particle (Vicar) on Jul 13, 2001 at 18:21 UTC |