Do you want to do this:- @numbers = split /[a-zA-Z]+/,$stat; # or @numbers = split /[^\d]+/,$stat; ? - Roger - ----- Original Message ----- From: "Michael Fowler" <michael@shoebox.net> To: "Tanton Gibbs" <thgibbs@deltafarms.com> Cc: <beginners@perl.org> Sent: Saturday, January 19, 2002 12:28 AM Subject: Re: Pattern Matching - Remove Alpha > On Wed, Jan 16, 2002 at 09:51:45PM -0500, Tanton Gibbs wrote: > > Michael brings up a good point...for this problem, you would probably be > > better served by tr > > > > $stat =~ tr/a-zA-Z//d; > > > > will delete any alpha character. > > > > Although split will do the job, I think tr would be a more "idiomatic" > > choice, probably more efficient too. > > That might work, except one of his requirements is that the numeric data be > placed into an array. > > tr/// is more efficient; I can't really guage its level of idiomicity > compared to split. > > > > > On Wed, Jan 16, 2002 at 05:38:56PM -0600, Hewlett Pickens wrote: > [snip] > > > > "$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. > [snip] > > > Michael "Fun with Language" Fowler > -- > Administrator www.shoebox.net > Programmer, System Administrator www.gallanttech.com > -- > > -- > To unsubscribe, e-mail: beginners-unsubscribe@perl.org > For additional commands, e-mail: beginners-help@perl.org > > > > >Thread Previous