Re: shorten code

2004-02-17 Thread Jan Eden
James Edward Gray II wrote: >On Feb 17, 2004, at 3:13 PM, Jan Eden wrote: > >> >> Rob Dixon wrote: >>> >>> my @data = map { tr/%//d; [split] } split /\n/, $str; >>> >> >> A little late maybe, but... >> >> Why do you have the second (in the order of operation) split operator >> in brackets? Shou

Re: shorten code

2004-02-17 Thread James Edward Gray II
On Feb 17, 2004, at 3:13 PM, Jan Eden wrote: Rob Dixon wrote: my @data = map { tr/%//d; [split] } split /\n/, $str; A little late maybe, but... Why do you have the second (in the order of operation) split operator in brackets? Shouldn't it just split $_ on whitespace if no arguments are given

Re: shorten code

2004-02-17 Thread Jan Eden
Rob Dixon wrote: > > my @data = map { tr/%//d; [split] } split /\n/, $str; > A little late maybe, but... Why do you have the second (in the order of operation) split operator in brackets? Shouldn't it just split $_ on whitespace if no arguments are given? - Jan -- If all else fails read the

Re: shorten code

2004-02-16 Thread John W. Krahn
James Kipp wrote: > > Hi Hello, > I want to split the string below into rows and then columns. I know i can do > a couple of splits, push array refs onto a new array, regex it, etc.. But I > was know the talented people on this list can shorten the code considerably. > I want to split at each ne

RE: shorten code

2004-02-16 Thread Kipp, James
> > my @data = map { tr/%//d; [split] } split /\n/, $str; > > :) Clever! but this may be the point where where it may be confusing as you and Paul mentioned :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: shorten code

2004-02-16 Thread Rob Dixon
James Kipp wrote: > > > > > $str = " > > > > /var 0.9950% > > > > /usr 0.5871% > > > > /tmp 0.49 1% > > > > " > > > > > > my @rows = map [split], split /\n/, $str; > > > for (@rows) { $_->[2] =~ tr/%//d } > > > > N

RE: shorten code

2004-02-16 Thread Kipp, James
> > > $str = " > > > /var 0.9950% > > > /usr 0.5871% > > > /tmp 0.49 1% > > > " > > > > my @rows = map [split], split /\n/, $str; > > for (@rows) { $_->[2] =~ tr/%//d } > > Not quite! Because the string starts and

Re: shorten code

2004-02-16 Thread Rob Dixon
Steve Grazzini wrote: > > Kipp, James wrote: > > I want to split at each new line for the row, then split the row into > > columns, and get rid of the "%" on the third column. > > > $str = " > > /var 0.9950% > > /usr 0.5871% > > /tmp

RE: shorten code

2004-02-16 Thread Kipp, James
> > > my @rows = map [split], split /\n/, $str; > > > for (@rows) { $_->[2] =~ tr/%//d } > > > > > > > Neat. You saved me 6 lines of code :) > > Thank You !! > > Make sure its meaningful to you or someone else maintaining > it. I would > rather see 6 extra lines of code and have it m

RE: shorten code

2004-02-16 Thread Paul Kraus
> > my @rows = map [split], split /\n/, $str; > > for (@rows) { $_->[2] =~ tr/%//d } > > > > Neat. You saved me 6 lines of code :) > Thank You !! Make sure its meaningful to you or someone else maintaining it. I would rather see 6 extra lines of code and have it mean something to me at

Re: shorten code

2004-02-16 Thread Rob Dixon
James Kipp wrote: > > I want to split the string below into rows and then columns. I know i can do > a couple of splits, push array refs onto a new array, regex it, etc.. But I > was know the talented people on this list can shorten the code considerably. > I want to split at each new line for the

RE: shorten code

2004-02-16 Thread Kipp, James
> my @rows = map [split], split /\n/, $str; > for (@rows) { $_->[2] =~ tr/%//d } > Neat. You saved me 6 lines of code :) Thank You !! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: shorten code

2004-02-16 Thread Steve Grazzini
Kipp, James wrote: I want to split at each new line for the row, then split the row into columns, and get rid of the "%" on the third column. $str = " /var 0.9950% /usr 0.5871% /tmp 0.49 1% " my @rows = map [split], sp