G
George
I thought I was past trouble working with simple file manipulations, but I
seem to be stumped here again:
#!/usr/bin/perl
use strict;
use warnings;
my $filename = 'larry1.txt';
my $outfile = 'processed1.txt'
open my $fh, '<', $filename or die "cannot open $filename: $!";
open my $gh, '>', $outfile or die "cannot open $filename: $!";
while (<$fh>) {
s/%%/%\n/;
print $gh, $_;
}
close($fh)
close($gh)
# perl larry1.pl
C:\MinGW\source> perl larry1.pl
"my" variable $filename masks earlier declaration in same scope at
larry1.pl lin
e 7.
"my" variable $filename masks earlier declaration in same statement at
larry1.pl
line 7.
syntax error at larry1.pl line 7, near "open "
Can't use global $! in "my" at larry1.pl line 7, near "$filename: $!"
syntax error at larry1.pl line 14, near ")
close"
Execution of larry1.pl aborted due to compilation errors.
C:\MinGW\source>
larry1.txt is 61 k of Larry Wall quotes, delimited by %% :
%%
if (instr(buf,sys_errlist[errno])) /* you don't see this */
-- Larry Wall in eval.c from the perl source code
%%
if (rsfp = mypopen("/bin/mail root","w")) { /* heh, heh */
-- Larry Wall in perl.c from the perl source code
%%
If you consistently take an antagonistic approach, however, people are
going to start thinking you're from New York.
-- Larry Wall to Dan Bernstein in
<[email protected]>
%%
I wanted to use them as a randomsig for dialog, which wants a single %
between quotes.
I tried the open statements a few different ways and get essentially the
same complaints from perl.exe.:-(
Thanks for your comment.
--
George
To those of you who received honours, awards and distinctions, I say well
done. And to the C students, I say you, too, can be president of the United
States.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/
seem to be stumped here again:
#!/usr/bin/perl
use strict;
use warnings;
my $filename = 'larry1.txt';
my $outfile = 'processed1.txt'
open my $fh, '<', $filename or die "cannot open $filename: $!";
open my $gh, '>', $outfile or die "cannot open $filename: $!";
while (<$fh>) {
s/%%/%\n/;
print $gh, $_;
}
close($fh)
close($gh)
# perl larry1.pl
C:\MinGW\source> perl larry1.pl
"my" variable $filename masks earlier declaration in same scope at
larry1.pl lin
e 7.
"my" variable $filename masks earlier declaration in same statement at
larry1.pl
line 7.
syntax error at larry1.pl line 7, near "open "
Can't use global $! in "my" at larry1.pl line 7, near "$filename: $!"
syntax error at larry1.pl line 14, near ")
close"
Execution of larry1.pl aborted due to compilation errors.
C:\MinGW\source>
larry1.txt is 61 k of Larry Wall quotes, delimited by %% :
%%
if (instr(buf,sys_errlist[errno])) /* you don't see this */
-- Larry Wall in eval.c from the perl source code
%%
if (rsfp = mypopen("/bin/mail root","w")) { /* heh, heh */
-- Larry Wall in perl.c from the perl source code
%%
If you consistently take an antagonistic approach, however, people are
going to start thinking you're from New York.
-- Larry Wall to Dan Bernstein in
<[email protected]>
%%
I wanted to use them as a randomsig for dialog, which wants a single %
between quotes.
I tried the open statements a few different ways and get essentially the
same complaints from perl.exe.:-(
Thanks for your comment.
--
George
To those of you who received honours, awards and distinctions, I say well
done. And to the C students, I say you, too, can be president of the United
States.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/