and I need to read this file line by line the file name is deb123.rpt and my code is.rem ***************************************************************** +***** .rem * + * .rem * deb123.rpt + * .rem ***************************************************************** +***** .rem .rem ------------------------ book_tab variables --------------------- .rem .declare book_no a14 .declare l_code a10 .declare l_book a12 .declare book_date a13
but its not giving any output and even its not printing the data at particular line in the file also... Please help me out for the codeuse IO::File; my $fh = IO::File->new(); die "File $ARGV[0] is there in the specified location but is of Zero b +ytes" if (-z $ARGV[0]); $ARGV[0] .= ".rpt"; $fh->open($ARGV[0], "r"); local($/); #my $data = $fh->getline; #$fh->close; while(defined($data = $fh->getline)){ if($data =~ /^\.r/){ print "This is a comment $data\n"; } if($data =~ /^\.dec/){ print "This is declared variable $data\n"; } } $fh->close;
In reply to Re^2: Extract the variable
by denzil_cactus
in thread Extract the variable
by denzil_cactus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |