Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: splitting a string

by prasadbabu (Prior)
on Dec 04, 2008 at 07:27 UTC ( #727883=note: print w/ replies, xml ) Need Help??


in reply to splitting a string

Hi,

From split doc,

"Empty trailing fields, on the other hand, are produced when there is a match at the end of the string (and when LIMIT is given and is not 0), regardless of the length of the match"
.

use strict; use warnings; my $string = "/home/source::::::::DATE:SUBJECT:NAME::::::"; my @array = split(/:/,$string, -1); $" = '><'; print "<@array>\n"; print scalar(@array); output: ------- </home/source><><><><><><><><DATE><SUBJECT><NAME><><><><><><> 17

Prasad


Comment on Re: splitting a string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-12-21 10:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls