[24506] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6686 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 13 09:05:47 2004

Date: Sun, 13 Jun 2004 06:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 13 Jun 2004     Volume: 10 Number: 6686

Today's topics:
    Re: foreach ($a, $b, $c)... (Sam Holden)
    Re: foreach ($a, $b, $c)... <xaonon@hotpop.com>
    Re: foreach ($a, $b, $c)... <ceo@nospam.on.net>
    Re: foreach ($a, $b, $c)... <tadmc@augustmail.com>
        Grep Pattern, matching any two consecutive words having <none@nil.com>
    Re: Grep Pattern, matching any two consecutive words ha <invalid-email@rochester.rr.com>
    Re: Grep Pattern, matching any two consecutive words ha <none@nil.com>
    Re: Grep Pattern, matching any two consecutive words ha <usenet@morrow.me.uk>
    Re: Grep Pattern, matching any two consecutive words ha <none@nil.com>
    Re: Grep Pattern, matching any two consecutive words ha <tadmc@augustmail.com>
        how about this one foreach... <ken_sington@nospam_abcdefg.com>
    Re: how about this one foreach... <invalid-email@rochester.rr.com>
    Re: how about this one foreach... (Bart Van der Donck)
    Re: how about this one foreach... <me@privacy.net>
    Re: how about this one foreach... (Anno Siegel)
    Re: how about this one foreach... <gnari@simnet.is>
    Re: how about this one foreach... <rwxr-xr-x@gmx.de>
    Re: how about this one foreach... (Anno Siegel)
    Re: killing my children <n.j.howes@warwick.ac.uk>
    Re: Operator overloading revisited <kalinaubears@iinet.net.au>
    Re: Perl 6 (was: 2 naive questions: Perl 6; Perl vs. sh <occitan@esperanto.org>
    Re: Perl 6 (was: 2 naive questions: Perl 6; Perl vs. sh <tadmc@augustmail.com>
    Re: reverse IP lookup for check all doimains on the ser (Anno Siegel)
    Re: using constant array <tadmc@augustmail.com>
    Re: using constant array <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 13 Jun 2004 01:09:29 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: foreach ($a, $b, $c)...
Message-Id: <slrnccnaa9.2h5.sholden@flexal.cs.usyd.edu.au>

On Sat, 12 Jun 2004 20:52:49 -0400,
	Ken Sington <ken_sington@nospam_abcdefg.com> wrote:
> has anyone tried:
> 
> foreach ($a, $b, $c){
>      ...
> }
> 
> well, it doesn't work.

It does work just fine, as long as your replace '...' with some valid
perl syntax.

"It doesn't work" isn't a useful problem description, especially when it
does in fact "work".

> but what if I wanted to do that?

Then you do it.

-- 
Sam Holden


------------------------------

Date: 13 Jun 2004 01:16:12 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: foreach ($a, $b, $c)...
Message-Id: <slrnccnaig.5gl.xaonon@xaonon.local>

Ned i bach <qDOdncluqdz9OFbdRWPC-g@speakeasy.net>, Ken Sington
<ken_sington@nospam_abcdefg.com> teithant i thiw hin:

> has anyone tried:
> 
> foreach ($a, $b, $c){
>      ...
> }
> 
> well, it doesn't work.

My, what a specific description of the problem.  It "works" fine for me,
assuming the variables had already been defined.

-- 
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
http://xaonon.dyndns.org/  Guaranteed content-free since 1999.  No refunds.
"Accepting that identity is relative means two things: that immortality is
impossible, and that immortality is inevitable." -- Eric Zetterbaum


------------------------------

Date: Sun, 13 Jun 2004 01:38:23 GMT
From: ChrisO <ceo@nospam.on.net>
Subject: Re: foreach ($a, $b, $c)...
Message-Id: <jeOyc.1058$Pt.999@newssvr19.news.prodigy.com>

Ken Sington wrote:
> has anyone tried:
> 
> foreach ($a, $b, $c){
>     ...
> }
> 
> well, it doesn't work.
> 
> but what if I wanted to do that?

Dude, what does "doesn't work" MEAN?  Provide an EXAMPLE.  It DOES work 
if you do it right:

$ perl -e '$a = "This"; $b = "DOES"; $c = "work!"; for ($a, $b, $c) { 
print "$_ \n" }'
This
DOES
work!

-ceo


------------------------------

Date: Sun, 13 Jun 2004 07:20:40 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: foreach ($a, $b, $c)...
Message-Id: <slrnccohko.hiq.tadmc@magna.augustmail.com>

Ken Sington <ken_sington@nospam_abcdefg.com> wrote:
> has anyone tried:
> 
> foreach ($a, $b, $c){
>      ...
> }
> 
> well, it doesn't work.


You are the only person who knows what "doesn't work" means when 
you say it.

One or more other people must know what you mean when you say it
if they are to be able to help you understand, fix or change it...


You have not given us enough information to get an answer.

Have you seen the Posting Guidelines that are posted here frequently?



-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 12 Jun 2004 22:56:18 -0400
From: "User" <none@nil.com>
Subject: Grep Pattern, matching any two consecutive words having 3 to 8 chars each
Message-Id: <xjPyc.181070$WQ5.2247587@wagner.videotron.net>

Hi,

What is the grep pattern to match (in a one line phrase) at least two
consecutive words having min 3 to max 8 chars each (number of chars need NOT be
the same in the two words)?

I can't find the proper pattern for that. It needs to be done solely by the
regexp engine (no further Perl instruction other than to recuperate the words
from the submatches).

Anyone knows?

Thanks a lot,

Daniel M.




------------------------------

Date: Sun, 13 Jun 2004 02:58:24 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Grep Pattern, matching any two consecutive words having 3 to 8 chars each
Message-Id: <40CBC295.9070407@rochester.rr.com>

User wrote:

 ...


> What is the grep pattern to match (in a one line phrase) at least two
> consecutive words having min 3 to max 8 chars each (number of chars need NOT be
> the same in the two words)?
> 
> I can't find the proper pattern for that. It needs to be done solely by the
> regexp engine (no further Perl instruction other than to recuperate the words
> from the submatches).
 ...
> Daniel M.
> 
> 
> 

Maybe something like:

    /(\w{3,8})\s+(\w{3,8})/

?

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



------------------------------

Date: Sun, 13 Jun 2004 00:01:43 -0400
From: "User" <none@nil.com>
Subject: Re: Grep Pattern, matching any two consecutive words having 3 to 8 chars each
Message-Id: <RgQyc.181942$WQ5.2286336@wagner.videotron.net>

> Maybe something like:
>
>     /(\w{3,8})\s+(\w{3,8})/

Thanks Bob.


I oversimplified my problem. My bad :-(

What if I want a match when from 2 to 6 consec words having min 3 to 8 chars?

Regards,

Daniel M.





------------------------------

Date: Sun, 13 Jun 2004 04:08:56 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Grep Pattern, matching any two consecutive words having 3 to 8 chars each
Message-Id: <cagk0n$iln$1@wisteria.csv.warwick.ac.uk>


Quoth "User" <none@nil.com>:
> > Maybe something like:
> >
> >     /(\w{3,8})\s+(\w{3,8})/
> 
> Thanks Bob.
> 
> I oversimplified my problem. My bad :-(
>
> What if I want a match when from 2 to 6 consec words having min 3 to 8
> chars?

This, particularly the 'must be a single regex' bit, smells of homework.
Nevertheless, try

/\w{3,8} (?: \s+ \w{3,8} ){1,5}/x

Now go read perldoc perlretut.

Ben

-- 
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die.                                                   ben@morrow.me.uk


------------------------------

Date: Sun, 13 Jun 2004 00:45:28 -0400
From: "User" <none@nil.com>
Subject: Re: Grep Pattern, matching any two consecutive words having 3 to 8 chars each
Message-Id: <SVQyc.99115$Rz.1903545@weber.videotron.net>

Ben,

Thanks very much. :-)

> >
> > What if I want a match when from 2 to 6 consec words having min 3 to 8
> > chars?
>
> This, particularly the 'must be a single regex' bit, smells of homework.

Nope. No homework (but not work either).
Just something I wanted to know how to do.

> Nevertheless, try
> /\w{3,8} (?: \s+ \w{3,8} ){1,5}/x

I _knew_ I'd get some great help here.

> Now go read perldoc perlretut.

Thanks for the tip.

Regards,

Daniel M.




------------------------------

Date: Sun, 13 Jun 2004 07:14:11 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Grep Pattern, matching any two consecutive words having 3 to 8 chars each
Message-Id: <slrnccoh8j.hiq.tadmc@magna.augustmail.com>

Bob Walton <invalid-email@rochester.rr.com> wrote:
> User wrote:
> 
> ...
> 
> 
>> What is the grep pattern to match (in a one line phrase) at least two
>> consecutive words having min 3 to max 8 chars each (number of chars need NOT be
>> the same in the two words)?
>> 
>> I can't find the proper pattern for that. It needs to be done solely by the
>> regexp engine (no further Perl instruction other than to recuperate the words
>> from the submatches).
> ...
>> Daniel M.
>> 
>> 
>> 
> 
> Maybe something like:
> 
>     /(\w{3,8})\s+(\w{3,8})/
                ^^
                ^^

That should likely be \W instead...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 12 Jun 2004 22:57:22 -0400
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: how about this one foreach...
Message-Id: <OtWdnfmpWYcPX1bdRWPC-w@speakeasy.net>

ok, how about this one:

         foreach ("remote_host",
                  "remote_user",
                  "time",
                  "request",
                  "status_number",
                  "bytes_sent",
                  "referer",
                  "user_agent",
                  "server_name",
                  "post_connection_status",
                  "download_time"
                 ){
             $_ =~ s/_/ /; # with this line, no I get no output!
             print "$_\n";
         }


it gives no output!


------------------------------

Date: Sun, 13 Jun 2004 03:02:40 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: how about this one foreach...
Message-Id: <40CBC396.1090404@rochester.rr.com>

Ken Sington wrote:

> ok, how about this one:
> 
>         foreach ("remote_host",
>                  "remote_user",
>                  "time",
>                  "request",
>                  "status_number",
>                  "bytes_sent",
>                  "referer",
>                  "user_agent",
>                  "server_name",
>                  "post_connection_status",
>                  "download_time"
>                 ){
>             $_ =~ s/_/ /; # with this line, no I get no output!
>             print "$_\n";
>         }
> 
> 
> it gives no output!

Hmmmm...I get an output.  It says:

"Modification of a read-only value attempted at junk459.pl line 13."

Your foreach loop is aliasing $_ to the elements of the given list, and 
then attempting to modify said elements via the alias.  Since those 
values are read-only, you get the message above.

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



------------------------------

Date: 13 Jun 2004 01:04:34 -0700
From: bart@nijlen.com (Bart Van der Donck)
Subject: Re: how about this one foreach...
Message-Id: <b5884818.0406130004.1d3aea7e@posting.google.com>

Ken Sington wrote...
>          foreach ("remote_host",
>                   "remote_user",
>                   "time",
>                   "request",
>                   "status_number",
>                   "bytes_sent",
>                   "referer",
>                   "user_agent",
>                   "server_name",
>                   "post_connection_status",
>                   "download_time"
>                  ){
>              $_ =~ s/_/ /; # with this line, no I get no output!
>              print "$_\n";
>          }
> it gives no output!

$_ is a readonly variable in the loop. It appears that this is caused
by the way your array is assigned (somewhat unusual in my experience).

If you want to modify $_, use something like:

my @array= ("remote_host", "remote_user", "time", "request",
"status_number", "bytes_sent", "referer", "user_agent", "server_name",
"post_connection_status", "download_time");
foreach (@array){
$_ =~ s/\_/ /;
print "$_\n";
}

I bet you also want 
$_ =~ s/\_/ /i;
in stead of 
$_ =~ s/\_/ /;
(the i would cause all underscores to be replaced by spaces)

Hope this helps
Bart


------------------------------

Date: Sun, 13 Jun 2004 20:44:23 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: how about this one foreach...
Message-Id: <2j2iejFqp7fiU1@uni-berlin.de>


"Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
news:OtWdnfmpWYcPX1bdRWPC-w@speakeasy.net...
> ok, how about this one:

Please don't start a new thread for an existing post.

>
>          foreach ("remote_host",
>                   "remote_user",
>                   "time",
>                   "request",
>                   "status_number",
>                   "bytes_sent",
>                   "referer",
>                   "user_agent",
>                   "server_name",
>                   "post_connection_status",
>                   "download_time"
>                  ){
>              $_ =~ s/_/ /; # with this line, no I get no output!
>              print "$_\n";
>          }
>
>
>it gives no output!

Absolute rubbish.  You would have got the message similar to:

"Modification of a read-only value attempted at foo.pl line 13."

Please ensure you are *very* specific with your question, your code sample,
your input and the expected results.

#!/usr/bin/perl
use strict;
use warnings;

my @items = qw(remote_host remote_user ...);

foreach (@items) {
  tr /_/ /;
  print "$_\n";
}






------------------------------

Date: 13 Jun 2004 09:27:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how about this one foreach...
Message-Id: <cah6l9$l1s$2@mamenchi.zrz.TU-Berlin.DE>

Tintin <me@privacy.net> wrote in comp.lang.perl.misc:
> 
> "Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
> news:OtWdnfmpWYcPX1bdRWPC-w@speakeasy.net...
> > ok, how about this one:
> 
> Please don't start a new thread for an existing post.
> 
> >
> >          foreach ("remote_host",
> >                   "remote_user",

[...]

> >                   "download_time"
> >                  ){
> >              $_ =~ s/_/ /; # with this line, no I get no output!
> >              print "$_\n";
> >          }
> >
> >it gives no output!
> 
> Absolute rubbish.  You would have got the message similar to:
> 
> "Modification of a read-only value attempted at foo.pl line 13."
> 
> Please ensure you are *very* specific with your question, your code sample,
> your input and the expected results.
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> my @items = qw(remote_host remote_user ...);
> 
> foreach (@items) {
>   tr /_/ /;
>   print "$_\n";
> }

The auxiliary array can also be anonymous:

    foreach ( @{[ qw( remote_host remote_user ...) ]} ) { ...

Anno


------------------------------

Date: Sun, 13 Jun 2004 09:50:35 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: how about this one foreach...
Message-Id: <cah7tq$7ev$1@news.simnet.is>

"Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
news:OtWdnfmpWYcPX1bdRWPC-w@speakeasy.net...
>

in case you really want to use the literal
list in the foreach statement, just use
a non-aliased temporary variable if you
need to modify the index value.

>          foreach ("remote_host",
           foreach my $x ("remote_host",

> ...
>              $_ =~ s/_/ /; # with this line, no I get no output!
               ($_ = $x) =~ s/_/ /;

gnari






------------------------------

Date: 13 Jun 2004 10:42:03 GMT
From: Lukas Mai <rwxr-xr-x@gmx.de>
Subject: Re: how about this one foreach...
Message-Id: <cahb1r$16f$1@wsc10.lrz-muenchen.de>

Bart Van der Donck schrob:
[...]
> I bet you also want 
> $_ =~ s/\_/ /i;
> in stead of 
> $_ =~ s/\_/ /;
> (the i would cause all underscores to be replaced by spaces)

No, it wouldn't; /i is for case insensitive matching. You mean /g.
Also escaping "_" is completely useless. And "$_ =~" is implicit, so we
can shorten this to
s/_/ /g;
(or simply tr/_/ /, as mentioned elsewhere).

HTH, Lukas
-- 
print+74.117.115.116,,qq.\c!..not::.her,Perl=>q$hacker,$,!($,=$")


------------------------------

Date: 13 Jun 2004 12:45:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how about this one foreach...
Message-Id: <cahi9f$g0$1@mamenchi.zrz.TU-Berlin.DE>

gnari <gnari@simnet.is> wrote in comp.lang.perl.misc:
> "Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
> news:OtWdnfmpWYcPX1bdRWPC-w@speakeasy.net...
> >
> 
> in case you really want to use the literal
> list in the foreach statement, just use
> a non-aliased temporary variable if you
> need to modify the index value.

The variable in "foreach ( ... )" is always an aliased to list elements,
whether it's named $_ or otherwise.

> 
> >          foreach ("remote_host",
>            foreach my $x ("remote_host",

That gets the same complaint about read-only values.

Anno


------------------------------

Date: Sun, 13 Jun 2004 09:52:37 +0100
From: "Nick Howes" <n.j.howes@warwick.ac.uk>
Subject: Re: killing my children
Message-Id: <cah4kn$nj7$1@wisteria.csv.warwick.ac.uk>

<ctcgag@hotmail.com> wrote in message
news:20040607130517.662$eC@newsreader.com...
> spacehopper_man@yahoo.com (Oliver) wrote:
>
> You have this backwards.  If you don't reap your children, they will
become
> zombies, and hang around until the parents exists.  Reaping your children
> when they happen to die is not related to killing your children when you
> die.
>

I'm not trolling or anything, it just makes me laugh reading stuff like
this... imagining if somebody who didn't know what perl was getting the
wrong end of the stick of this thread :)




------------------------------

Date: Sun, 13 Jun 2004 18:28:11 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Operator overloading revisited
Message-Id: <40cc114c$0$28943$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

Anno Siegel wrote:

> 
> Ah... Cross-class overloading.  A lot of fun can be had with that.
> 

Yes - and that probably includes "fun" in the sense of hair removal :-)

> Basically, you're right.  If the classes know nothing about each other,
> the behavior you describe is what you get.  If both operands overload
> an operator, the left operand wins out.  The name of the implementing
> method is not relevant here, btw.

Yep - that's mainly what I was wanting to know.

> 
> If the classes are allowed to know about each other, the overload
> routine can check its second operand and implement a different
> behavior.
> 

Haven't thought much along those lines ... but it's worth some 
considerstion, at least.

Thanks Anno.

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



------------------------------

Date: Sun, 13 Jun 2004 13:19:03 +0200
From: Daniel Pfeiffer <occitan@esperanto.org>
To: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl 6 (was: 2 naive questions: Perl 6; Perl vs. shell scripts)
Message-Id: <20040613131903.706b942e.occitan@esperanto.org>

Saluton,

Ben Morrow <usenet@morrow.me.uk> skribis:

> You won't have to go back to square one when moving from perl5 to perl6.
> Perl6 will still be perl, and the basic concepts and syntax of the
> language will be the same. I would imagine that perl5 will continue to
> be supported for a long time after perl6 is released, as well.

What I have seen of perl6 scares me to hell!

The syntax of scalars, lists and hashes is completely changed.  Right now
logically a single value is a scalar and written with $ no matter where it
comes from.  In the future this will be way confusing with @ or % to access
some scalars.  Not only is it illogical, but it also means relearning and
keeping these things well sorted out in your mind.

Likewise, the new possibilities of regexes sound fantastic, but why did they
have to go and change so much in the existing regex syntax???

If I get this right, perl6 will behave like perl5 if the package keyword
appears.  That can smooth the way somewhat, but for every source, you'll still
have to rewrite it all once you want to use some new stuff.  ARGHHH!

I think perl5 will have a very long life!

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- 
lerne / learn / apprends / lär dig / ucz się    Esperanto:
                              http://lernu.net/


------------------------------

Date: Sun, 13 Jun 2004 07:27:01 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl 6 (was: 2 naive questions: Perl 6; Perl vs. shell scripts)
Message-Id: <slrnccoi0l.hiq.tadmc@magna.augustmail.com>

Daniel Pfeiffer <occitan@esperanto.org> wrote:
> Saluton,
> 
> Ben Morrow <usenet@morrow.me.uk> skribis:
> 
>> You won't have to go back to square one when moving from perl5 to perl6.
>> Perl6 will still be perl, and the basic concepts and syntax of the
>> language will be the same. I would imagine that perl5 will continue to
>> be supported for a long time after perl6 is released, as well.
> 
> What I have seen of perl6 scares me to hell!


Me too.

But what I had seen of Perl 5 scared me. I got over it.

What I had seen of Perl 4 scared me. I got over it.

We will get over it.  :-)


> I think perl5 will have a very long life!


Me too.

Even grungy old Perl 4 lived for many years, and the v4 to v5 "delta"
was less than the v5 to v6 transition will be.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 13 Jun 2004 08:27:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: reverse IP lookup for check all doimains on the server
Message-Id: <cah34p$l1s$1@mamenchi.zrz.TU-Berlin.DE>

PHP2 <gp@nospm.hr> wrote in comp.lang.perl.misc:
> I have opened bid for $60 by rentacoder.com abot that:
> http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=157535
> 
> Can you create this script for me?

This is a technical news group.  If you have a job to offer, do it
in a group with "jobs" in its name.

[TOFU snipped]

Anno


------------------------------

Date: Sat, 12 Jun 2004 20:23:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: using constant array
Message-Id: <slrnccnb47.vsj.tadmc@magna.augustmail.com>

A. Farber <Alexander.Farber@t-online.de> wrote:

> I have defined a list of constants in my script:
> 
>     use constant DEFPLATS => qw(ARMI ARM4 THUMB WINS WINSCW);


> and it doesn't interpolate in strings.


      Constants defined using this module cannot be interpolated 
      into strings like variables.


> Do you have any advices on that?


What "that"? It does exactly what it says it will do.

If that isn't want you want, then do something else.  <g>


   perldoc constant


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 12 Jun 2004 20:28:04 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: using constant array
Message-Id: <slrnccnbd4.vsj.tadmc@magna.augustmail.com>

A. Farber <Alexander.Farber@t-online.de> wrote:

>     use constant DEFPLATS => qw(ARMI ARM4 THUMB WINS WINSCW);


> I have to put it in brackets for the hash slices:
> 
>     @prj_platforms{(DEFPLATS)} = (1) x length DEFPLATS;


That supplies a list context, which will keep "use warnings" quiet.

You can put the parenthesis elsewhere if you like it better (I do):

   @prj_platforms{ DEFPLATS() } = (1) x length DEFPLATS;

(whitespace is your friend if used wisely.)



Also, length() no worky on lists (nor arrays):

   perldoc -f length



-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6686
***************************************


home help back first fref pref prev next nref lref last post