Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Problem using | char as delimiter for split

by prasadbabu (Prior)
on Aug 29, 2006 at 13:14 UTC ( [id://570150]=note: print w/replies, xml ) Need Help??


in reply to Problem using | char as delimiter for split

'|' is a special character in Perl, so you have to backslash it as '\|' to make it as normal pipe character. Take a look at perlre.

$a="0427320060001|39104|20020|190|2"; my ($num1, $num2,$num3,$num4,$num5)=split(/\|/,$a); print "$num1\n$num2\n$num3\n$num4\n$num5"; prints: 0427320060001 39104 20020 190 2

Prasad

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found