Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: array range positions

by juanito23 (Novice)
on Apr 24, 2014 at 08:46 UTC ( [id://1083542]=note: print w/replies, xml ) Need Help??


in reply to Re: array range positions
in thread array range positions

Hi, yes sorry for not put all the code here, but the interesting part is on the elsif clause. Anyway, seems the best way to go through is as you advised with a for counter

Here's the whole if / else cycle i'm using for a better understanding:
foreach (@csv_out){ if($_ eq ""){ #$_ = 'NULL'; $_ = 'NULL'; print WRITEFILE "$_" . "," ; } elsif ($_ =~ m/[a-zA-Z]/ || ($j<10 && $j>=0)){ print "$_\n"; $_=~ s/,/ /g; print WRITEFILE '"'."$_".'"' . "," ; $j=$j-1; } else { $_=~ s/,/ /g; print WRITEFILE "$_" . "," ; }

so, the first if is to match any empty field, the elsif will match the fields with characters, and the else will do all the others. Hopefuly your advise sorted the problem.

Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-19 10:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found