On Wed, 29 May 2002, Prakash Kailasa wrote:

> 
> You need \d+ to capture more than single-digit numbers.
> You don't need single quotes around 0.
> Don't need the semi-colon at the end.
> No need to escape . within character class.

I had to give you _something_ to work with ;)

> 
> # 47 chars
>   -p s#(\d+)\s+([\d.]+)#"$1 $2 ".($1>0?$2/$1:0)#e
> 
> If the number is guaranteed to be non-negative (which I assume it will
> be):
> 
> # 45 chars
>   -p s#(\d+)\s+([\d.]+)#"$1 $2 ".($1?$2/$1:0)#e


ah yes -- good catch.
I had the '>0' in there because my first attempt (the 'splice' version)
didn't automatically distinguish between lines containing profile data,
and informational lines such as page and column headings -- thus $1
(or $_[0]) would need to be definitely numeric. 

Si.

> 
> /prakash
> 


Reply via email to