Michael Alipio <[EMAIL PROTECTED]> asked:
> #!/usr/local/bin/perl
> use strict;
>
> my $string = "Theres more than 1 way to do it"; if ($string
> =~ /\w+$/){ print "Hooray! pattern found"; print $1; }
>
> My goal is to print the last word.
> However, it only prints "Hooray! pattern found";
>
> Any idea what's wrong with $1??
Try "$string =~ /(\w+$)/" instead - you need the braces to
capture the value you want to print.
HTH,
Thomas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>