Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Welcome to the Monastery
 
PerlMonks  

Re: Splits and pipes

by bobn (Chaplain)
on Sep 06, 2003 at 17:23 UTC ( [id://289509]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Splits and pipes

The first argument to split is (usually, and definitely in this case) a regular expression. The pipe symbol | is a metacharacter in regexes meaning 'or' - so you've told split to split off whenever it matches a null character or a null cahracter. This happens between every character.

I think what you wanted was: ($acc_num, $ofname,$junk,$olname,$junk2) = split /\|/, $line, 5; where the backslash makes the pipe character match literally.

--Bob Niederman, http://bob-n.com

All code given here is UNTESTED unless otherwise stated.

Replies are listed 'Best First'.
Re: Re: Splits and pipes
by cens (Novice) on Sep 06, 2003 at 17:26 UTC
    Man, I don't know how I missed that... should have known better. Thanks.

      I don't miss that one much anymore since the day I spent *hours* trying to ffigure out why split(/./, $ip_address) wouldn't work right. Complete aggravation is a good memory aid!

      --Bob Niederman, http://bob-n.com

      All code given here is UNTESTED unless otherwise stated.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://289509]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.