jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:
_____________________________________________________#!/usr/local/bin/perl -w use strict; my @a=(1..99); my (@names,@name_nums); @names=name_nums(@a); print "@names"; sub name_nums { my (%list,@name_nums,$this_num, @input); @input=@_; @list{1..9}=qw(one two three four five six seven eight nine); foreach (@input){ if (exists $list{ $_ }){ push @name_nums, $list{ $_ }; }else{ push (@name_nums,$_); } } return @name_nums; }
edit - Petruchio Mon Oct 1 00:04:27 UTC 2001: Minor Formatting adjustments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Change from @a=(1..99) to @a=\STDIN\ = problems
by TStanley (Canon) on Oct 01, 2001 at 03:00 UTC | |
|
Re: Change from @a=(1..99) to @a=\STDIN\ = problems
by tommyw (Hermit) on Oct 01, 2001 at 02:59 UTC |