Home » Infrastructure » Unix » Problem related to File handling in Perl
Problem related to File handling in Perl [message #233660] Fri, 27 April 2007 02:09 Go to next message
lokeshg82
Messages: 23
Registered: February 2007
Location: chennai
Junior Member
Dear Experts,

i wanted to run sipmle file handing program in perl.
hope this is very basic doubt which i have,
pls see the example code below,

vi tax12.pl
open(FILEHANDLE, ">file.txt") or die "cannot open file for reading: $!";
print FILEHANDLE "I love goldfishes, they're so delicious!";
close(FILEHANDLE) or die "an error occured while trying to close the file: $!";


when i run the script,it was throwing below error
tax12: syntax error at line 1 : `(' unexpected


i verified the syntax through net,it was fine only..

pls do the needful,
thanks in advance..

Re: Problem related to File handling in Perl [message #233672 is a reply to message #233660] Fri, 27 April 2007 02:48 Go to previous messageGo to next message
lalit.thawani
Messages: 11
Registered: April 2007
Junior Member
Try replacing the parenthesis with "space" in Line 1
Re: Problem related to File handling in Perl [message #233702 is a reply to message #233672] Fri, 27 April 2007 03:37 Go to previous messageGo to next message
lokeshg82
Messages: 23
Registered: February 2007
Location: chennai
Junior Member
thanks a lot-:)

now its worked fine.
Re: Problem related to File handling in Perl [message #233703 is a reply to message #233702] Fri, 27 April 2007 03:41 Go to previous message
siddharth.solanki
Messages: 1
Registered: April 2007
Location: Bombay
Junior Member
One of the reasons that this solution worked is that Perl is a loosely coupled language, n often spaces work in place of parenthesis....... it also works while passing argument to a subroutine!!
Previous Topic: Problem related to file attribute (permissions)
Next Topic: HotBackup Script
Goto Forum:
  


Current Time: Sat Dec 03 18:16:11 CST 2016

Total time taken to generate the page: 0.08918 seconds