Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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;


Comment on Re: Wrong content of variable passed to sub
Select or Download Code
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 lurking in the Monastery: (7)
As of 2015-07-08 01:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls