David Gilden wrote:
> Greetings,
> 
> ## This Does what _not_ do what I would expect  -- return the first 3
> characters of type '\w' 
> 
> $tmp ="Joe Smore1qazxswedcvfrtgbnhytujmkilptyoXXXXt5000";
> $tmp =~ s/(^\w{3})(.*)/$1/;
> print "$tmp\n";
        I ran it and it displayed Joe. What version of Perl are running and on 
what OS? I am running under Windows XP and Perl is AS 5.8.4 ( 810 ).

        Are you running with strict and warnings? Exactly what did your code 
that you ran look like? You have given a paste, but what other code is there?
        I would leave the ^ outside, but as stated, my print put out Joe.

Wags ;)
> 
> # is ^ better outside the '()s'?
> 
> ####
> $tmp ="Joe Smore1qazxswedcvfrtgbnhytujmkilptyoXXXXt5000";
> ($tmp) =  $tmp =~ s/(^\w{3})(.*)/$1/;
> print "$tmp\n";   # name  contains "1"  not "Joe"
> 
> # $1 captures "Joe" --- but
> 
> ## This Does what I want !!
> $tmp ="Joe Smore1qazxswedcvfrtgbnhytujmkilptyoXXXXt5000";
> ($tmp) = $tmp =~ m/^(\w{3})/;
> print "$tmp\n"; ## "Joe"
> 
> The above code works fine but I am not sure on reading the syntax
> -- and would this qualify as untainting data? -- and yes I realize we
> are clobbering $tmp 
> 
> 
> Thanks & Happy Holidays -- from Cow Town
> 
> Dave Gilden
> 
> (kora musician / audiophile / webmaster @ www.coraconnection.com  /
> Ft. Worth, TX, USA) 
> 
> PS: Please reply to me off list (and CC the list so that others can
> benefit!) 



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to