> > Opps, I missed that. Instead of:
> > @results = map { my $line = $_; chomp $line; $line =~ s/\s+//g; $line }
(@data);
> > try:
> > my @newresults = map { my $line = $_; chomp $line; $line =~ s/\s+//g;
> > shift (@results) . $line } (@data);
> > @results = @newresults;
> >
> > -David
This works fine, but can be simplier :
my @newresults = map { s/\s+//g; shift (@results) . $_ } (@data);
> Ok ... please forgive my n00b-ness, but can you help me understand a
> couple of things here. This part:
>
> shift (@results) . $line
This means :
$x = shift @result; # where $x means to $_ or the value carries in memory.
$x = $x . $line
>
> Is it the same as:
>
> shift @results . $line
While this means :
$x = @results . $line ; # @results here means scalar @results ( how many
elems inside @results )
shift $x ; # then cause error.
>
> I'm thinking "no". But I don't know what the difference is. I also
The difference is the scope for the 'shift' , with ( ), the scope for shift
is @results,
without ( ) , the scope for shift is @results . $line .
> don't understand what exactly that shift is doing, but if I understand
perldoc -f shift
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>