in reply to Re^4: pull single value
in thread pull single value

Then you're not dealing with a single value as you claimed. You want to iterate over a list of values. Why do you think it's a problem storing that list in an array?

As for how, you've already been shown how. You were even given a fully functional program.

Replies are listed 'Best First'.
Re^6: pull single value
by Anonymous Monk on Nov 10, 2009 at 18:43 UTC
    Thanks for all your efforts. Let's simplify this. I am trying to put this in a subroutine. But it is not working. can you suggest on this?
    sub OfficePhoneNumber { my @numbers = @_; my $number; my @results; foreach $number (@numbers) { if ($number =~ m/(^\d{3}-\d{4}$)/) { push @results, $number; } } return @results; }
    &OfficePhoneNumber "554-3214,+1 302-342-2345";
      It works for OfficePhoneNumber("554-3214", "+1 302-342-2345"); Isn't that what you want anyway?
        yes, that is correct. Actually i need to put this script in a different apps. so as of now i am testing in window. I am putting everything in the file.pl and running it thru command prompt as perl file.pl. I am wondering why i am not getting the results. Thanks, Pamela