in reply to Re: Parsing String
in thread Parsing String

I couldn't get it to work I am trying to go item by item using reg. expressions.

Replies are listed 'Best First'.
Re: Re: Re: Parsing String
by davido (Cardinal) on Apr 21, 2004 at 19:03 UTC
    Well, here's a method that iterates over each of the items found:

    my $results = "Home Town, Log in activity: 57 DI activity: 13 FA activ +ity: 13 FAI activity: 4 Login activity: 23 Not Found activity: 4"; foreach my $number ( $results =~ m/\d+/g ) { print "$number\n"; }


    Dave

Re: Parsing String
by Belgarion (Chaplain) on Apr 21, 2004 at 19:03 UTC

    I guess I don't understand what you're trying to do then. davido's code pulls out all the numbers into an array that you can the loop over and do whatever you like with. What exactly are you trying to do with your code?