Hi,
The subroutine below reads a file and assigns values
to variables. It ran fine with the following input
file, file1. However, if I add '#' to the file in the
first couple of lines (file2), it errored. 

How can I modify my subroutine to parse file2 by
skipping those '#'?  

file1:
userid=apps
userpwd=appspwd
database=mydb

file2:
#
# Usage: <variable>=<value>
#
userid=apps
userpwd=appspwd
database=mydb

sub mysub {
        open(PFILE,$ARGV[0]) || die ("Could not open
file");
        @pf=<PFILE>;
        foreach $param (@pf) {
                chop($param);
                my ($pname,$pval)=split(/=/,$param);
                $ary{$pname}=$pval;
        }
        close(PFILE);
}

thanks.

susan


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Sports - Sign up for Fantasy Baseball. 
http://baseball.fantasysports.yahoo.com/

Reply via email to