On Wed, Jan 16, 2002 at 05:38:56PM -0600, Hewlett Pickens wrote:
> The detail:
> 
>  "$stat" is a string that has alpha and numeric data in it.
>  I want to remove all of the alpha and put the numeric data into an array.
> 
>  The first attempt:
> 
>    my @nums = split(/a-zA-Z/,$stat); # removes all data from the string
> 
>  The second attempt:
> 
>    my @nums = split(/a-z/,$stat); # removes all data from the string

You've somehow got tr/// and regexes confused, or perhaps tr/// and split,
or perhaps you're just making stuff up.  ;)

Regardless, split(/a-zA-Z/, $stat) splits the string $stat on the string
"a-zA-Z".  Say, for example, $stat = "foo bar a-zA-Z baz qux".  Your split
would result in the list ("foo bar ", " baz qux").  You were probably aiming
for the regex /[a-zA-Z]/, or better yet, \w, as in, split(/\w/, $stat), or
perhaps split(/\w+/, $stat).

Please read perldoc perlre and the regex sections of your books.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to