This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: perl with cygwin 1.5 doesn't fly.


Check u're perl code again

Use strict;   # that way you must use 'my' to define all scalars

My %module = ( 'cygwin'=>'Cygwin' ); # note 'cygwin'
My $var = $module{$^0} || 'Unix'  # can't remember what special variable =
# $^0 but note that since %module and
# $var are in the same scope you should try not to name %module and $module
bcos $module refers to an entry in the hash of %modules

Print "$var\n";


gnjoku@andromeda.rutgers.edu


-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of
Gerrit P. Haase
Sent: Saturday, July 19, 2003 6:20 PM
To: cygwin@cygwin.com
Cc: perl5-porters@perl.org
Subject: perl with cygwin 1.5 doesn't fly.

Hallo,

I'm getting strange errors when I compile Perl 5.8 with Cygwin 1.5,
well, miniperl.exe compiles, but then the first simple tests break:

1. This as script executed with miniperl.exe:
%module = ( cygwin  => 'Cygwin' );
$module = $module{$^O} || 'Unix';
print "$module\n";

gives what is expected:
$ ./miniperl ./minitest.pl
Cygwin


2. If I change the script now to be:
my %module = ( cygwin  => 'Cygwin' );
$module = $module{$^O} || 'Unix';
print "$module\n";

I get:
$ ./miniperl ./minitest.pl
Unix


3. And if a second 'my' is added:
my %module = ( cygwin  => 'Cygwin' );
my $module = $module{$^O} || 'Unix';
print "$module\n";

I get:
$ ./miniperl ./minitest.pl



What is wrong with 'my' on Cygwin 1.5?


Gerrit
-- 
=^..^=


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]