> #!/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; }
You need to wrap the bit you wish to extract in (paremphasis) and it'll be put
into $1. If you do two (wraps), you'll get $1 and $2, and so on. Or you can
assign the extraction-match direclty: my ($one, $two) = $search_this =~
/(put_into_one)(put_into_two)$/.
--
> My goal is to print the last word.
> However, it only prints "Hooray! pattern found";
>
> Any idea what's wrong with $1??
>
> Thanks
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection
> around http://mail.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED] For
> additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>