Hi,
I have a Perl program which I'm having some difficulty with, essentially I'm
trying to `shift()' all the ellements in an array untill an element
containing a forward slash is encountered. Howerver, the method I'm using is
producing incorrect results.
If the forward slash is placed infront of "fairy" or "dust" the program
executes correctly, if it's placed infront of one of the other words in the
list the program doesn't produce the correct results.
Can anyone help with this? What am I doing wrong? If it matters, I'm using MacOS X.
---CODE--- #!/usr/bin/perl -w
use strict;
my @array = ("fairy", "goblin", "emerald","dust","/dice");
foreach (@array){ if(/(\/)+.+/){ print "last\n"; last; }else{ print "shift\n"; shift @array; } } print "@array";
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>