Sorry you had already corrected both my errors before I could hit the reply
button:-)

I don't think he want's the " for each item since he wrote: How if I want to
get: @aaa = (":1",":2",":3",":4",":5") how to do it?

probably means that he want's the array to be @list =
(":1",":2",":3",":4",":5"); and since it's not qw() the "" are to quote each
item

Etienne

"Kipp, James" wrote:

> 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]

S/MIME Cryptographic Signature

Reply via email to