actually this way will catch the : in front of 1 and avoid starting at 0: @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 > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]