Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
P is for Practical
 
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 pondering the Monastery: (5)
As of 2014-04-20 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls