OT:Perl on Windows

William O'Higgins william.ohiggins-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Fri Mar 11 17:19:19 UTC 2005


On Fri, Mar 11, 2005 at 11:42:52AM -0500, Alex Beamish wrote:
>However, your comment that 'your program' (whatever that is) cannot
>read the file, nor is it able to create an output file, suggests
>something is not right. Can you explain?

I'll try.  Here's the example program:

#/usr/bin/perl -w

$input = $ARGV[0];
$output = 'test.txt';

open(TXT, "$input") or die "Cannot open $input for some reason, perhaps:
$!\n"

if (-e $output) {
   print "$output already exists, try a different name.\n";
   } else {
   open(OUT, ">$output") or die "Cannot open this file: $!\n";
}
	   
print OUT "test";
	   
while (<TXT>) {
	$data .= $_;
}
		   
print $data;
		   
print OUT $data;

I get this error on run:

syntax error ... near ") {"

*and* test.txt doesn't get created, but there are no complaints.
Something is wrong, but I'm just not sure what.  Any suggestions?
Thanks again.
-- 

yours,

William

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gtalug.org/pipermail/legacy/attachments/20050311/1a4c575e/attachment.sig>


More information about the Legacy mailing list