On Tue, Mar 05, 2002 at 05:51:16PM +0800, henry wrote:
> I want to print the first 5 characters in front of a definite word 
> as follows:
> It's supposed that the definite word is AU.
> INPUT       -->aassewrab cdAUwst 
> OUTPUT(I hope to get )  - ->ab cd
> 
> Could you give some hint ?

There's probably a better way to do it, but something like this
should work:

#!/usr/bin/perl
$def_word = 'AU';
$input = 'aassewrab cdAUwst';
$input =~ /$def_word/;
$output = substr ($`,-5);
print $output;
-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to