Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: split question

by allolex (Curate)
on Jan 30, 2004 at 22:41 UTC ( [id://325432]=note: print w/replies, xml ) Need Help??


in reply to split question

The pattern is a regular expression pattern. ;)

split /\|/, $line;

have a look at perldoc -f split (split) and perlre.

--
Allolex

Update Sat Jan 31 05:05:13 2004: Added slashes. I saw that particular syntax on comp.lang.perl.misc, and just assumed that it would work (mea maxima culpa).

Replies are listed 'Best First'.
Re: Re: split question
by davido (Cardinal) on Jan 31, 2004 at 08:24 UTC
    split \|, $line;

    Huh? Try:  split /\|/, $line;

    You forgot your quote-like regexp characters.

    Or to answer the OP's question:

    my $delimiter = quotemeta( '|' ); my @array = split /$delimiter/, $line;


    Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found