Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: spliting arrays

by arthas (Hermit)
on Nov 05, 2003 at 09:58 UTC ( #304661=note: print w/replies, xml ) Need Help??


in reply to Re: Re: spliting arrays
in thread spliting arrays

Hi!

This should do what you need:

use strict; my $ident="aaa bbb ccc-ddd eee fff-ggg hhh iii-jjj kkk lll-"; my @id = split /-|\s/, $ident; foreach my $i(0..$#id) { print $id[$i]; if ((($i+1) % 3) == 0) { print "\n"; } else { print ' '; } }

Michele.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2019-05-25 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (152 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!