On 5/1/07, oryann9 <[EMAIL PROTECTED]> wrote:
snip
my $regexp  = qr/(host:\w+)/is;
my $regexp1 = qr/(onlinejfs.*)/is;
my $regexp2 = qr/(jfs\sversion.*)/is;
snip

Why are you creating these regexes so far from where they are used?
If you are going to do this at least give them meaningful names.

snip
open (JFS, "+<$jfsFile") or die "file '$jfsFile' was not opened $!";
snip

use the three argument version of open, if you don't you will
eventually be bitten by a file name that contains information that
open thinks is part of the mode:

open JFS, "+<", $jfsFile or die "file '$jfsFile' was not opened $!";

Also, you may consider using lexical varaibles instead of bareword file handles:

open my $jfs, "<", $jfsFile or die "file '$jfsFile' was not opened $!";
while (<$jfs>) {

The benefit is $jfs is much easier to pass around (well, there are
others as well like auto-closing when the variable goes out of scope).

snip
        next if ! length $_;    ## skip line of length
snip

it is easy to misread "if !" so use unless instead.  Also length works
on $_ if no argument is passed to it.

next unless length;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to