R
Robbie Hatley
Howdy. I'm trying to get this (should be) simple test
program to work, but it does different things on different
perl implimentations:
#!/bin/perl
open my $F, $0 or die $!;
while (<$F>)
{
chomp;
print ("one two three " . "$_" . " DEF \n");
}
close $F;
Here's the output with djgpp's version of perl:
wd=C:\scripts
%
wd=C:\scripts
%perl dollscor
one two three #!/bin/perl DEF
one two three open my $F, $0 or die $!; DEF
one two three while (<$F>) DEF
one two three { DEF
one two three chomp; DEF
one two three print ("one two three " . $_ . " DEF \n"); DEF
one two three } DEF
one two three close $F; DEF
wd=C:\scripts
%
Pretty much what you'd expect. BUT...
But here's the output with cygwin's version of perl:
bash-3.00
/cygdrive/c/scripts
%dollscor
DEF wo three #!/bin/perl
DEF wo three open my $F, $0 or die $!;
DEF wo three while (<$F>)
DEF wo three {
DEF wo three chomp;
DEF wo three print ("one two three " . $_ . " DEF \n");
DEF wo three }
DEF wo three close $F;
bash-3.00
/cygdrive/c/scripts
%
What's going on there??? The DEF should print at the end of the
line, but is over-writing the beginning instead.
Is one of my perl implimentations broken, or am I doing something
"undefined"? Perhaps something about the way I'm using $_ ?
I can't figure it out.
For reference, here's the version info:
djgpp:
%perl -v
This is perl, v5.6.1 built for dos-djgpp
Copyright 1987-2001, Larry Wall
MS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis
djgpp v2 port (jpl5003c) by Hirofumi Watanabe, 1996
djgpp v2 port (perl5004+) by Laszlo Molnar, 1997-1999
cygwin:
%perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int
Copyright 1987-2005, Larry Wall
Puzzled,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant
program to work, but it does different things on different
perl implimentations:
#!/bin/perl
open my $F, $0 or die $!;
while (<$F>)
{
chomp;
print ("one two three " . "$_" . " DEF \n");
}
close $F;
Here's the output with djgpp's version of perl:
wd=C:\scripts
%
wd=C:\scripts
%perl dollscor
one two three #!/bin/perl DEF
one two three open my $F, $0 or die $!; DEF
one two three while (<$F>) DEF
one two three { DEF
one two three chomp; DEF
one two three print ("one two three " . $_ . " DEF \n"); DEF
one two three } DEF
one two three close $F; DEF
wd=C:\scripts
%
Pretty much what you'd expect. BUT...
But here's the output with cygwin's version of perl:
bash-3.00
/cygdrive/c/scripts
%dollscor
DEF wo three #!/bin/perl
DEF wo three open my $F, $0 or die $!;
DEF wo three while (<$F>)
DEF wo three {
DEF wo three chomp;
DEF wo three print ("one two three " . $_ . " DEF \n");
DEF wo three }
DEF wo three close $F;
bash-3.00
/cygdrive/c/scripts
%
What's going on there??? The DEF should print at the end of the
line, but is over-writing the beginning instead.
Is one of my perl implimentations broken, or am I doing something
"undefined"? Perhaps something about the way I'm using $_ ?
I can't figure it out.
For reference, here's the version info:
djgpp:
%perl -v
This is perl, v5.6.1 built for dos-djgpp
Copyright 1987-2001, Larry Wall
MS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis
djgpp v2 port (jpl5003c) by Hirofumi Watanabe, 1996
djgpp v2 port (perl5004+) by Laszlo Molnar, 1997-1999
cygwin:
%perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int
Copyright 1987-2005, Larry Wall
Puzzled,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant