in reply to Re: extracting variables from regex
in thread extracting variables from regex
echo 1234.45.67.890 | perl -ne'split /\./; printf "%X%X%X%X",@_'
From split's documentation:
In scalar context, returns the number of fields found and splits into the @_ array. Use of split in scalar context is deprecated, however, because it clobbers your subroutine arguments.Why not have split in list context, and forget about @_?
printf "...", split /\./
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(MeowChow) Re3: extracting variables from regex
by MeowChow (Vicar) on Apr 03, 2002 at 12:01 UTC | |
|
Re: Re: Re: extracting variables from regex
by RMGir (Prior) on Apr 02, 2002 at 22:17 UTC |