I changed the code and still got errors.
use strict; open(FILE, "< obj.list") or die "can't open file : $! " ; open(NEW, "> new.list"); chomp(@lines = <FILE>); foreach my $item (@lines) { if ($item =~/ADB/) { print NEW "grant select , update, delete, insert on " $item " user;" ; print NEW " grant select on " $item " to tcmesg_select ;" ; if ($item =~ /p_/) { print NEW " grant execute on " $item" to tcmesg_admin; " ; } } close(FILE); Below are the errors: alar found where operator expected at grant.pl line 13, at end of line (Missing operator before ?) syntax error at grant.pl line 13, near ""grant select , update, delete, insert on " $item " String found where operator expected at grant.pl line 13, near "$item " user;"" (Missing operator before " user;"?) Scalar found where operator expected at grant.pl line 14, at end of line (Missing operator before ?) syntax error at grant.pl line 14, near "" grant select on " $item " String found where operator expected at grant.pl line 14, near "$item " to tcmesg_select ;"" (Missing operator before " to tcmesg_select ;"?) Scalar found where operator expected at grant.pl line 16, at end of line (Missing operator before ?) syntax error at grant.pl line 16, near "" grant execute on " $item" String found where operator expected at grant.pl line 16, near "$item" to tcmesg_admin; "" (Missing operator before " to tcmesg_admin; "?) Missing right bracket at grant.pl line 24, at end of line syntax error at grant.pl line 24, at EOF Execution of grant.pl aborted due to compilation errors. -----Original Message----- From: Kipp, James [mailto:James.Kipp@;mbna.com] Sent: Friday, October 25, 2002 12:20 PM To: Vo, Synh; [EMAIL PROTECTED] Subject: RE: read from a file > > I'm trying to read from a file and based on the some of the > matched info, > print out certain statements. This is probably very easy for > > open(FILE, "< obj.list") or die "can't open file : $! " ; > open(NEW, "> new.list"); > > chomp(@lines = <FILE>); > > foreach my $item (@lines) { > if (/ADB/) { > print "grant select , update, delete, insert on " > $item " user;" > ; > print " grant select on " $item " to tcmesg_select ;" ; > if (/p_/) { > print " grant execute on " $item" to tcmesg_admin; " ; > } > } > > close(FILE); > > close(NEW); first thing, add 'use strict' and 'use warnings' to your script Did you want to print the results to a the new file ? if so your print statements should be like print NEW " grant select on \" $item \" to tcmesg_select ;" ; can you tells what exactly went wrong. did you have errors or just not output ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]