running perl script problem

While executing perl scriptit gives some compling issue, please help out

$inputFilename="c:\allways.pl";
open (FILEH,$inputFilename) or die "Could not open log file";
 
Error : Could not open log file at c:\allways.pl line 4

learner in Perl

When using double quotes, you have to use a backslash to escape another backslash if it's to be taken literally. The reason is that with double quotes, all kinds of stuff get interpolated, eg. you can use "\n" for a newline, "\t" for a tab, ...

2 ways to solve this:

  • write "c:\\allways.pl"
  • write "c:/allways.pl"