Can't open file

Hi,

I have a simple perl script, thru which i am trying to update entries in SQL server DB.

use DBI;
use CGI;

my $DSN = 'driver={SQL Server};Server=xxxxxx\SQLEXPRESS;Database=Northwind;UID=sa;PWD=xxxxxxxx';

#Connect the database handle.
$dbh = DBI->connect("DBI:ODBC:$DSN") or die "$DBI::errstr\n";

if($dbh) {
print "DB Connection Success \n";
}
else{
print "DB Connection failure \n";
}

open (OUTPUT, ">C:\PerlScripts\OUTPUT.TXT") || die ("can't open\n");

open (FILE, "<C:\PerlScripts\commands.sql") || die ("can't open commands\n");

while (<FILE>)
{
$sql = $_;
$update = $dbh->do($sql);

if($update)

{ print OUTPUT "Success: Now executing $sql\n";
}

else
{
print OUTPUT "Failure;";
$update = null;
$sql = $_;
$update = $dbh->do($sql);
print OUTPUT "Success: Now executing $sql\n";
}
}

$dbh->disconnect();

However when i run the script i am getting the following error

"Can't open commands". The path specified is correct and a null output file is generated. DB connection is successful. Cant figure out why the sql file is not being read.

OS is windows

Any help is appreciated. Thanks in advance.

in your die, try using $!, it give you more info

open(FILE, "<C:\path\to\file") || die $!;

Thanks.....the issue is resolved. It was a problem with / vs \.

Thanks for helping troubleshoot it.