in reply to Re^4: Recomendations For Learning perl?
in thread Recomendations For Learning perl?
Command line one-liner:
perl -wMstrict -E 'print for grep /adam/, <>' /usr/share/dict/words
Script form (overly verbose so it's easier to understand):
use warnings; use strict; my $word_file = '/usr/share/dict/words'; open my $fh, '<', $word_file or die "can't open the $word_file file!: $!"; while (my $line = <$fh>){ if ($line =~ /adam/){ print $line; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Recomendations For Learning perl?
by Laurent_R (Canon) on Dec 07, 2016 at 22:14 UTC | |
by stevieb (Canon) on Dec 08, 2016 at 00:30 UTC |