Sorry. me again. one more time..this will include the "" around each item, exactly what you needed: @list = split (/:/ ,$line); for (0..(@list-1)) { @list[$_] = sprintf("\":%d\"",@list[$_]); }
> -----Original Message----- > From: Etienne Marcotte [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 22, 2001 12:47 PM > To: [EMAIL PROTECTED] > Subject: Re: How to split it? > > > use strict; > > $line = "1:2:3:4:5"; > @list = split (/:/ ,$line); > > for (1..@list) { @list[$_] = sprintf(":%d",@list[$_]; } > > that's it that's all > @list now contains (":1",":2",":3",":4",":5") > > Etienne > > Wagner-David wrote: > > > As you do your processing, then you could build the > output the way you want it to appear: > > > > foreach( @aaa ) { > > my $MyId = sprintf "\":%d\"", $_; > > # now $MyId looks like ":1" then ":2", etc. > > ] > > > > Wags ;) > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Monday, October 22, 2001 09:05 > > To: [EMAIL PROTECTED] > > Subject: How to split it? > > > > if I split: > > > > $line = "1:2:3:4:5"; > > @aaa = split (/:/ ,$line); > > > > I will get: @aaa = (1,2,3,4,5) > > How if I want to get: @aaa = (":1",":2",":3",":4",":5") how > to do it? > > (":" can be a pattern) > > > > TIA, > > basssang > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]