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

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";

Replies are listed 'Best First'.
Re^7: pull single value
by ikegami (Patriarch) on Nov 10, 2009 at 19:20 UTC
    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

        What do you mean by you're not getting results? On the screen? You're not printing anything.