Perl programs written in a style that is as close to C as possible are more easily understood by most other programmers.
Something like this?
undef $/;
my @text = split (//, <$FILE>);
for (my $i = 0; $i <= $#text; $i++) {
my $j = $i;
if (($text[$i++] == 'h' || $text[$i++] == 'H') &&
$text[$i++] == 'e'...) {
while ($j <= $i) {
print $text[$j++];
}
}
}
I'll be the first that would recommend a solid foundation in programming, C or otherwise, but writing Perl as if it was C, isn't what would make your Perl better understood by other (Perl?) programmers.
|