Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Wrong content of variable passed to sub

by jwkrahn (Monsignor)
on Aug 21, 2013 at 04:53 UTC ( #1050279=note: print w/replies, xml ) Need Help??


in reply to Wrong content of variable passed to sub

my @fields = split(/\|/); my $name = $fields[0]; $name =~ s/\s*//; $name =~ s/\s*$//; my $value = $fields[1]; $value =~ s/\s*//; $value =~ s/\s*$//; my $status = $fields[3]; $status =~ s/\s*//; $status =~ s/\s*$//;

That should be:

my ( $name, $value, undef, $status ) = split /\|/; s/^\s+//, s/\s+$// for $name, $value, $status;

Replies are listed 'Best First'.
Re^2: Wrong content of variable passed to sub
by olafmar (Novice) on Aug 21, 2013 at 20:29 UTC
    I implemented your suggestion too, thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050279]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2016-09-24 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (462 votes). Check out past polls.