rdettwyler has asked for the wisdom of the Perl Monks concerning the following question:
Why does this give me nothing? I want to see this:$cat foo apple apple pear pear zucchini zucchini eggplant eggplant potato potato $cat bar #!/usr/bin/perl $map{'apple'} = 'fruit'; $map{'pear'} = 'fruit'; $map{'zucchini'} = 'vegetable'; $map{'eggplant'} = 'vegetable'; $map{'potato'} = 'vegetable'; open FILE, "foo" or die$!; my @lines = <FILE>; while (my $line = <FILE>) { chomp; print "$map($_)\n";
Thank you so much. Your humble servant, RickyDapple fruit apple fruit pear fruit pear fruit zucchini vegetable zucchini vegetable zucchini vegetable eggplant vegetable eggplant vegetable eggplant vegetable potato vegetable potato vegetable
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: big job, starting with little script
by zek152 (Pilgrim) on Jul 14, 2010 at 17:43 UTC | |
Re: big job, starting with little script
by Roy Johnson (Monsignor) on Jul 14, 2010 at 17:43 UTC | |
Re: big job, starting with little script
by muba (Priest) on Jul 15, 2010 at 08:02 UTC | |
by fullermd (Vicar) on Jul 15, 2010 at 16:43 UTC | |
Re: big job, starting with little script
by Generoso (Prior) on Jul 15, 2010 at 23:00 UTC |