OT:Perl on Windows

Zbigniew Koziol zkoziol-Zd07PnzKK1IAvxtiuMwx3w at public.gmane.org
Fri Mar 11 17:27:13 UTC 2005


William O'Higgins wrote:
> 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];

print $input at this point.

However, I am so lazy that I would bother at all to repair it.

I would just run like that:

perl myprogram.pl < input.txt > output.txt . But you would need to 
change the line with while(<TXT>) to wgile(<>)

zb.

> $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.


-- 
Zbigniew Koziol, SoftQuake^(tm) Open Source Business Solutions
Web Development, Linux, Web Mail Fax Voice Servers, Networking
Consultations, Innovative Technologies Tel/Fax: 1-416-530-2780
Toronto,  Canada,  http://www.softquake.ca,  info-lcEyp1+e+UdAFePFGvp55w at public.gmane.org
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list