delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Message-Id: | <200307212350.h6LNoegJ014262@mail1.acecape.com> |
From: | "Matthew O. Persico" <persicom AT acedsl DOT com> |
To: | <gnjoku AT pegasus DOT rutgers DOT edu>, "'Gerrit P. Haase'" <gp AT familiehaase DOT de>, |
<cygwin AT cygwin DOT com> | |
CC: | <perl5-porters AT perl DOT org> |
Date: | Mon, 21 Jul 2003 19:50:46 -0400 |
In-Reply-To: | <000601c34eeb$2b20d940$0401a8c0@vaio> |
Subject: | RE: perl with cygwin 1.5 doesn't fly. |
Mime-Version: | 1.0 |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id h6LNp5308914 |
On Sun, 20 Jul 2003 14:17:23 -0400, George Njoku wrote: >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 Um, no. %module is a hash $module{somekey} locates a value in the hash %module $module is a separate scalar. Try this: use strict; use warnings; my %module = ('cygwin' => 'Cygwin'); my $module = 'Lunar'; print "hash el: " . $module{'cygwin'} . "\n"; print "scalar: " . $module . "\n"; I will admit might be confusing to use a scalar $module and a hash %module, but it is not an error. > >Print "$var\n"; > > >gnjoku AT andromeda DOT rutgers DOT edu > > >-----Original Message----- >From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On >Behalf Of Gerrit P. Haase Sent: Saturday, July 19, 2003 6:20 PM To: >cygwin AT cygwin DOT com Cc: perl5-porters AT perl DOT 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 -- Matthew O. Persico -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |