On Thu, Dec 06, 2001 at 08:21:30AM -0600, Booher Timothy B 1stLt AFRL/MNAC wrote:
> For example I have 'ABCDEFGH' and I want to get the right three letters:
> Right('abcdefgh',3) = 'fgh'

Use a negative value for the range argument, as described in perldoc -f
substr:

void:chris~ % echo "abcdefgh" | perl -nle 'print substr($_, -3, 3)'
[ -3 makes us start here ^, 3 makes us travel for three characters. ]

> Left can be done with substring (x,0) I am sure

Yes, indeed: echo "abcdefgh" | perl -nle 'print substr($_, 0, 3)' 

Hope this helps,

- ~C.
-- 
$a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to