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

(@rest = split(/ /, $rest);
so that it would be in array form to use pop. well, straightforward,
$apass = pop @rest;
doesn't work, I
print "ATTEMPT PASS: $apass\n";
and get nothing at all. I thought perhaps maybe I was just a really bad coder and $rest or @rest was empty, but I can
print "\$REST: $rest\n";
and
foreach $i @rest { print "\@REST: $i\n";
and I get data everytime! (the correct data!)

So I did more looking and saw that pop @rest; should return $_, so I

print "\$_: $_\n";
and get NO data other than my "$_" literal...

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


In reply to unGodly problems with pop() by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.