[21830] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4034 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 27 11:06:13 2002

Date: Sun, 27 Oct 2002 08:05:07 -0800 (PST)
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, 27 Oct 2002     Volume: 10 Number: 4034

Today's topics:
    Re: AUTOLOAD and multiple inheritance <goldbb2@earthlink.net>
    Re: AUTOLOAD and multiple inheritance <tassilo.parseval@post.rwth-aachen.de>
    Re: backticks/system command <gbhDELETE@fpcc.net>
    Re: backticks/system command <nospam@nospam.com>
    Re: Before I buy the Book ... <pasdespam_desmond@zeouane.org>
    Re: Before I buy the Book ... <vm.mayer@comcast.net>
    Re: Before I buy the Book ... (Alan Barclay)
    Re: defined() upon aggregates (hashes and arrays) is no <spicano@netzero.net>
    Re: defined() upon aggregates (hashes and arrays) is no (tî'pô)
        Newbie-Qeustion <mstep@t-online.de>
    Re: Newbie-Qeustion <pasdespam_desmond@zeouane.org>
    Re: Newbie-Qeustion <mstep@t-online.de>
    Re: Newbie-Qeustion <mstep@t-online.de>
    Re: Newbie-Qeustion <kurzhalsflasche@netscape.net>
    Re: Newbie-Qeustion <jurgenex@hotmail.com>
    Re: Newbie-Qeustion <usenet@tinita.de>
    Re: Newbie-Qeustion <usenet@tinita.de>
        Off topic Was Re: Before I buy the Book ... (ebchang)
        Wow <fatcat01010@yahoo.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 27 Oct 2002 00:42:35 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: AUTOLOAD and multiple inheritance
Message-Id: <3DBB6EBB.64FFB865@earthlink.net>

Tassilo v. Parseval wrote:
> 
> Also sprach Da Witch:
> 
> > Suppose that I have two base classes A and B, both of which
> > implement the AUTOLOAD method, and I want to have a subclass C that
> > inherits from both (@C::ISA = ('A', 'B')).  How can I write the
> > AUTOLOAD to pass control along the chain (possibly to another
> > AUTOLOAD method) in case it doesn't know how to handle a particular
> > method call?
> 
> Not sure what you want. Your new class C will inherit both the
> AUTOLOAD from A as well as the one from B. Since AUTOLOAD is basically
> a catch-all mechanism, the usual left-to-right search through @INC
> will not apply and C will always call B::AUTOLOAD().

Untrue.  When you do $c->foo(), and subroutine foo doesn't exist, it
does *two* left-to-right searches -- first, it goes through the
inheritance tree looking for a subroutine foo, and after that fails, it
will go through the inheritance tree a second time, looking for
AUTOLOAD.

> If with 'chain' you mean going to the next AUTOLOAD if one wasn't able
> to do its work, you should be able to say (in A::AUTOLOAD() for
> instance):
> 
>     B::AUTOLOAD($AUTOLOAD);
> 
> I never tested that though, but don't see any reason why it should
> fail.

Actually, it would be safer to do:

sub AUTOLOAD {
   # stuff
   require NEXT; # from CPAN
   return shift()->NEXT::ACTUAL::AUTOLOAD( @_ );
}

Which should work even if class A is inherited by things other than C.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: 27 Oct 2002 09:30:34 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: AUTOLOAD and multiple inheritance
Message-Id: <apgbnq$oj8$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Benjamin Goldberg:

> Tassilo v. Parseval wrote:

>> Not sure what you want. Your new class C will inherit both the
>> AUTOLOAD from A as well as the one from B. Since AUTOLOAD is basically
>> a catch-all mechanism, the usual left-to-right search through @INC
>> will not apply and C will always call B::AUTOLOAD().
> 
> Untrue.  When you do $c->foo(), and subroutine foo doesn't exist, it
> does *two* left-to-right searches -- first, it goes through the
> inheritance tree looking for a subroutine foo, and after that fails, it
> will go through the inheritance tree a second time, looking for
> AUTOLOAD.

That's the general behaviour, yes. I omitted the first left-to-right
search since the OP talked about AUTOLOAD invocation which requires that
no such method exists in any of the direct superclasses.

>> If with 'chain' you mean going to the next AUTOLOAD if one wasn't able
>> to do its work, you should be able to say (in A::AUTOLOAD() for
>> instance):
>> 
>>     B::AUTOLOAD($AUTOLOAD);
>> 
>> I never tested that though, but don't see any reason why it should
>> fail.
> 
> Actually, it would be safer to do:
> 
> sub AUTOLOAD {
>    # stuff
>    require NEXT; # from CPAN
>    return shift()->NEXT::ACTUAL::AUTOLOAD( @_ );
> }
> 
> Which should work even if class A is inherited by things other than C.

Heh, a Damianism.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Sat, 26 Oct 2002 22:19:09 -0600
From: Gary Hodges <gbhDELETE@fpcc.net>
Subject: Re: backticks/system command
Message-Id: <3DBB693D.C607C91A@fpcc.net>



Gary Hodges wrote:

> Gary Hodges wrote:
>
> > Bob Walton wrote:
> >
> > > Gary Hodges wrote:
> > >
> > > > I'm missing something basic.  I've distilled my problem down to the
> > > > following code:
> > > > #---------------
> > > > use strict;
> > > > my $file = "any.doc";
> > > > my $cmd ="D:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE";
> > >
> > > > `\"$cmd\" \"$file\"`;
> > > >
> > > > #system "\"$cmd\" \"$file\"";
> > > > #system ("\"$cmd\" \"$file\"");
> > > > #system (qq|\"$cmd\" \"$file\"|);
> > > > #system qq|\"$cmd\" \"$file\"|;
> > > > #system qq|"$cmd" "$file"|;
> > > > #---------------
> > > >
> > > > When I run this using the backticks line or any of the system lines I
> > > > get a complaint that
> > > > 'D:\Program'
> > > > is not a known command.  The short question is "What I missing here?"
> > > > What do I need to do to get the full command with spaces executed?
> > >
> > > It doesn't appear to me that you are missing anything.  They all work
> > > fine on my system (Windoze 98SE, AS Perl build 633, with D: replaced by
> > > C: since Word is on C: on my system).  What version of Windoze are you
> > > using?
> >
> > This is on a Win2000 install.  perl -v gives v5.6.0 build 623.  When I
> > install v5.6.1 build (I think) 633 they all work.  Ultimately I want to
> > make an "executable" with perl2exe.  With the 633 build I would get the
> > same error I am getting now when I made an executable.
> >
> > Curiously, if I run
> >  `\"$cmd\"`;
> > by itself it opens Word.
>
> I have just had success.  I finally stumbled across the following combination
> of quotes that worked:
>
> `""$cmd" "$file""`;
>
> That opens Word with the document.  I haven't played around with the other
> system commands yet.

OK, I guess I should follow up with a bit more info.  I just uninstalled v5.6.0
build 623 and reinstalled v5.6.1 build 633.  The above command doesn't work with
the newer version of Perl.  While I still had the older version installed I was
able to use perl2exe to make a functional executable of the program I've been
working on.

So, all those commands at the top of this post work with v5.6.1 b633 but you
can't make a functional executable with perl2exe.  None of those commands work
with 5.6.0 b623.  If you add the extra double quotes like above ( `""$cmd"
"$file""`;  ) it works with 5.6.0 b623 AND you can make a functional executable
with perl2exe.

I guess I should send the perl2exe folks a note about this...

Gary



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

Date: Sun, 27 Oct 2002 00:09:01 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: backticks/system command
Message-Id: <3dbb907c$1_3@nopics.sjc>


"Gary Hodges" <gbhDELETE@fpcc.net> wrote in message
news:3DBB693D.C607C91A@fpcc.net...
>
>
> Gary Hodges wrote:
>
> > Gary Hodges wrote:
> >
> > > Bob Walton wrote:
> > >
> > > > Gary Hodges wrote:
> > > >
> > > > > I'm missing something basic.  I've distilled my problem down to
the
> > > > > following code:
> > > > > #---------------
> > > > > use strict;
> > > > > my $file = "any.doc";
> > > > > my $cmd ="D:\\Program Files\\Microsoft
Office\\Office\\WINWORD.EXE";
> > > >
> > > > > `\"$cmd\" \"$file\"`;
> > > > >
> > > > > #system "\"$cmd\" \"$file\"";
> > > > > #system ("\"$cmd\" \"$file\"");
> > > > > #system (qq|\"$cmd\" \"$file\"|);
> > > > > #system qq|\"$cmd\" \"$file\"|;
> > > > > #system qq|"$cmd" "$file"|;
> > > > > #---------------
> > > > >
> > > > > When I run this using the backticks line or any of the system
lines I
> > > > > get a complaint that
> > > > > 'D:\Program'
> > > > > is not a known command.  The short question is "What I missing
here?"
> > > > > What do I need to do to get the full command with spaces executed?
> > > >
> > > > It doesn't appear to me that you are missing anything.  They all
work
> > > > fine on my system (Windoze 98SE, AS Perl build 633, with D: replaced
by
> > > > C: since Word is on C: on my system).  What version of Windoze are
you
> > > > using?
> > >
> > > This is on a Win2000 install.  perl -v gives v5.6.0 build 623.  When I
> > > install v5.6.1 build (I think) 633 they all work.  Ultimately I want
to
> > > make an "executable" with perl2exe.  With the 633 build I would get
the
> > > same error I am getting now when I made an executable.
> > >
> > > Curiously, if I run
> > >  `\"$cmd\"`;
> > > by itself it opens Word.
> >
> > I have just had success.  I finally stumbled across the following
combination
> > of quotes that worked:
> >
> > `""$cmd" "$file""`;
> >
> > That opens Word with the document.  I haven't played around with the
other
> > system commands yet.
>
> OK, I guess I should follow up with a bit more info.  I just uninstalled
v5.6.0
> build 623 and reinstalled v5.6.1 build 633.  The above command doesn't
work with
> the newer version of Perl.  While I still had the older version installed
I was
> able to use perl2exe to make a functional executable of the program I've
been
> working on.
>
> So, all those commands at the top of this post work with v5.6.1 b633 but
you
> can't make a functional executable with perl2exe.  None of those commands
work
> with 5.6.0 b623.  If you add the extra double quotes like above ( `""$cmd"
> "$file""`;  ) it works with 5.6.0 b623 AND you can make a functional
executable
> with perl2exe.
>
> I guess I should send the perl2exe folks a note about this...
>
> Gary
>

Try to escape spaces with forward slashes "\ " and see if that works.




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

Date: Sun, 27 Oct 2002 11:28:31 +0000
From: Desmond Coughlan <pasdespam_desmond@zeouane.org>
Subject: Re: Before I buy the Book ...
Message-Id: <slrnarnjev.1ik6.pasdespam_desmond@lievre.voute.net>

Le Sat, 26 Oct 2002 22:32:13 -0500,  Amadeus <Amadeus@none.com> a écrit : 

{ snip }

>> <aside: Jeeeeesus .....>

> What you have to realize, is that to many, Perl isn't a mere language, it's
> a religion.  So you can't refer to one of the holy scripts-ures as "shit,"
> without getting a shitload of it in return.

Noted.  I shall stick around, and attempt to treat the script-ures with the
respect due to them.  :-) 

-- 
Desmond Coughlan      |CUNT#1 YGL#4 YFC#1 YFB#1 UKRMMA#14 two#38
desmond @ zeouane.org |BONY#48 ANORAK#11
http: // www . zeouane . org


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

Date: Sun, 27 Oct 2002 09:25:56 -0500
From: Mike Mayer <vm.mayer@comcast.net>
Subject: Re: Before I buy the Book ...
Message-Id: <vm.mayer-380BCF.09255627102002@news-east.giganews.com>


 "Amadeus" <Amadeus@none.com> wrote:
> "Desmond Coughlan" <pasdespam_desmond@zeouane.org> wrote in message
> > you all Mormons, or something ?
> >
> > I apologised once.  The use of the word 'shit' is so commonplace now as
> > to be almost meaningless.  Never did I imagine that it would provoke
> > such an outcry.
> >
> What you have to realize, is that to many, Perl isn't a mere language, it's
> a religion.  So you can't refer to one of the holy scripts-ures as "shit,"
> without getting a shitload of it in return.

Please don't hang this on the insecurities of Perl users.  

The original poster made a major social faux pas in ANY setting.  You 
might as well walk into a sidewalk cafe in Paris and complain about all 
the french food shit... or into an art museum and complain about all the 
painting shit....

While it is certainly true that the core elements of any culture can be 
compared to some extent to holy writ, please don't insinuate those who 
defend these core elements are "religious fanatics."

mike


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

Date: 27 Oct 2002 14:52:57 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Before I buy the Book ...
Message-Id: <1035730377.751363@elaine.furryape.com>

In article <slrnarmc32.1hge.pasdespam_desmond@lievre.voute.net>,
Desmond Coughlan  <pasdespam_desmond@zeouane.org> wrote:
>I apologised once.  The use of the word 'shit' is so commonplace now as
>to be almost meaningless.  Never did I imagine that it would provoke
>such an outcry.  

This is an international newsgroup. Behaviour which is commonplace
in wherever you are may be unheard of in other places.



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

Date: Sun, 27 Oct 2002 00:49:09 -0700
From: "spicano" <spicano@netzero.net>
Subject: Re: defined() upon aggregates (hashes and arrays) is not guaranteed to produce intuitive results
Message-Id: <apg5pm$9v2$1@news01.intel.com>

> > Was wondering why perl 'vivifies' like that?
> > Why doesn't perl just quit 'early' with undef on a read?
>
> Because autovivification is often very handy. Imagine you have:
>
>     %hash = (
>         key1 => {   nested1 => 'value1',
>                     nested2 => 'value2', },
>         key2 => {   nested1 => 'value1',
>                     nested2 => 'value2', },
>         key3 => ... );
>
> built from a file or so. You can't always know whether 'key1' or 'key2'
> or whatever already exists. Now you can simply insert:
>
>     $hash{key2}->{nested3} = 'value3';
>
> even if 'key2' hadn't been there before. If you first had to create it
> thusly:
>
>     $hash{key2} = { };
>
> you'd overwrite anything that would have been there previously. So that
> would result in a lot of exists() tests that would need to be done
> recursively for arbitrarily deep structures.
>
> Nonetheless, a mere exists() shouldn't autovivify the keys in between so
> IMHO that's actually a bug (but a known one).
>
> Tassilo


On write/initialize, we all benefit from not having to explicitly create
intermediate
array/hash references.

But on read accesses, this auto-vivification still does not make any logical
sense to me.
I only see disadvantages: slowing down read accesses because it creates
these
dangling array/hash references,  & creating side-effects/bugs to program &
guard
against.

Silvio




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

Date: Sun, 27 Oct 2002 13:38:00 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Re: defined() upon aggregates (hashes and arrays) is not guaranteed to produce intuitive results
Message-Id: <7sjnrukhkq64429gbbnhuhpsfn3206k9gv@4ax.com>

spicano bravely attempted to attach 47 electrodes of knowledge to the
nipples of comp.lang.perl.misc by saying:

>But on read accesses, this auto-vivification still does not make any logical
>sense to me.
>I only see disadvantages: slowing down read accesses because it creates
>these
>dangling array/hash references,  & creating side-effects/bugs to program &
>guard
>against.

This means that every statement in perl would need to know if it's a
rvalue or a lvalue. 
Which I assume isn't the case (although I may be wrong).

P.S. is it "a rvalue" or "an rvalue"?


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

Date: Sun, 27 Oct 2002 11:18:01 +0100
From: Marek Stepanek <mstep@t-online.de>
Subject: Newbie-Qeustion
Message-Id: <B9E17BE8.31B37%mstep@t-online.de>

Sorry, I read my first Perl-Book, and I am writing my first script, but
cannot figure out the following, also if it is for you certainly an obvious
question: 

my @array (a, b, c);

my $scalar = something #probably a b or c?

how I ask, whether my $scalar is PART of @array, that means whether it
contains a, b or c ???

I am on Mac 9.2.2, but this should not change anything to this fundamental
question. 


greetings and thank you in advance


marek


______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_de________
__________________http://www.PodiumInternational.de___________________
______________________________________________________________________






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

Date: Sun, 27 Oct 2002 11:32:56 +0000
From: Desmond Coughlan <pasdespam_desmond@zeouane.org>
Subject: Re: Newbie-Qeustion
Message-Id: <slrnarnjn8.1ik6.pasdespam_desmond@lievre.voute.net>

Le Sun, 27 Oct 2002 11:18:01 +0100,  Marek Stepanek <mstep@t-online.de> a écrit : 
> my @array (a, b, c);
> 
> my $scalar = something #probably a b or c?
> 
> how I ask, whether my $scalar is PART of @array, that means whether it
> contains a, b or c ???

Hey, I can answer that ... shouldn't it be, 

my @array = qw (a,b,c);
my $scalar = $array[x];
			# where x is zero-indexed number

 ..? 

-- 
Desmond Coughlan      |CUNT#1 YGL#4 YFC#1 YFB#1 UKRMMA#14 two#38
desmond @ zeouane.org |BONY#48 ANORAK#11
http: // www . zeouane . org


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

Date: Sun, 27 Oct 2002 13:07:38 +0200
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: Newbie-Qeustion
Message-Id: <B9E1959A.3261B%mstep@t-online.de>

In slrnarnjn8.1ik6.pasdespam_desmond@lievre.voute.net on 27.10.2002 13:32
Uhr, Desmond Coughlan, pasdespam_desmond@zeouane.org wrote :

> Le Sun, 27 Oct 2002 11:18:01 +0100,  Marek Stepanek <mstep@t-online.de> a
> écrit : 
>> my @array (a, b, c);
>> 
>> my $scalar = something #probably a b or c?
>> 
>> how I ask, whether my $scalar is PART of @array, that means whether it
>> contains a, b or c ???
> 
> Hey, I can answer that ... shouldn't it be,
> 
> my @array = qw (a,b,c);
> my $scalar = $array[x];
> # where x is zero-indexed number
> 
> ..? 


Hello, bonjour Desmond,

je me suis exprimé mal, je crois en tous les cas!

I was too quick hitting the <enter> key. Also sorry for my insignificant
"subject" line. 

I want to do something, if $scalar is PART of my array ...


my @array = (a,b,c);
my $scalar = d; #my scalar could also change to "c" for example, while the
sript is reading in a file

foreach $i (0..$#array)
{
    if ($scalar eq $array[$i]) #here is my problem, is $scalar PART of
@array??? not "eq" ??? only PART of ...
    {
    do something here
    }
    else
    {
    do some other things here
    }
    $i++;
}


______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_org_______
__________________http://www.PodiumInternational.org__________________
______________________________________________________________________




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

Date: Sun, 27 Oct 2002 13:22:44 +0200
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: Newbie-Qeustion
Message-Id: <B9E19924.3276A%mstep@t-online.de>

In B9E1959A.3261B%mstep@t-online.de on 27.10.2002 13:07 Uhr, Marek Stepanek,
mstep@t-online.de wrote :

> In slrnarnjn8.1ik6.pasdespam_desmond@lievre.voute.net on 27.10.2002 13:32
> Uhr, Desmond Coughlan, pasdespam_desmond@zeouane.org wrote :
> 
>> Le Sun, 27 Oct 2002 11:18:01 +0100,  Marek Stepanek <mstep@t-online.de> a
>> écrit : 
>>> my @array (a, b, c);
>>> 
>>> my $scalar = something #probably a b or c?
>>> 
>>> how I ask, whether my $scalar is PART of @array, that means whether it
>>> contains a, b or c ???
>> 
>> Hey, I can answer that ... shouldn't it be,
>> 
>> my @array = qw (a,b,c);
>> my $scalar = $array[x];
>> # where x is zero-indexed number
>> 
>> ..? 

Once again too quick:

I want to do something, if $scalar is PART of my array ... I am reading in a
FILE, which gives me a Line-by-Line-Scalar. I need to know, whether it is
contained in my @array.


my @array = (a,b,c);
my $scalar = d; #my scalar could also change to "c" for example, while the
sript is reading in a file

foreach $i (0..$#scalar)
{
  if ($scalar eq $array[$i]) #here is my problem, is $scalar PART of
@array??? not "eq" ??? only PART of ...
  {
  do something here
  }
  else
  {
  do some other things here
  }
  $i++;
}



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

Date: Sun, 27 Oct 2002 14:26:08 +0100
From: Dominik Seelow <kurzhalsflasche@netscape.net>
Subject: Re: Newbie-Qeustion
Message-Id: <3DBBE970.5010109@netscape.net>

Marek Stepanek announced:
> In B9E1959A.3261B%mstep@t-online.de on 27.10.2002 13:07 Uhr, Marek Stepanek,
> mstep@t-online.de wrote :
> 
> 
>>In slrnarnjn8.1ik6.pasdespam_desmond@lievre.voute.net on 27.10.2002 13:32
>>Uhr, Desmond Coughlan, pasdespam_desmond@zeouane.org wrote :
>>
>>
>>>Le Sun, 27 Oct 2002 11:18:01 +0100,  Marek Stepanek <mstep@t-online.de> a
>>>écrit : 
>>>
>>>>my @array (a, b, c);
>>>>
>>>>my $scalar = something #probably a b or c?
>>>>
>>>>how I ask, whether my $scalar is PART of @array, that means whether it
>>>>contains a, b or c ???
>>>
>>>Hey, I can answer that ... shouldn't it be,
>>>
>>>my @array = qw (a,b,c);
>>>my $scalar = $array[x];
>>># where x is zero-indexed number
>>>
>>>..? 
>>
> 
> Once again too quick:
> 
> I want to do something, if $scalar is PART of my array ... I am reading in a
> FILE, which gives me a Line-by-Line-Scalar. I need to know, whether it is
> contained in my @array.
> 
> 
> my @array = (a,b,c);
> my $scalar = d; #my scalar could also change to "c" for example, while the
> sript is reading in a file
> 
> foreach $i (0..$#scalar)
you didn't define an array @scalar, did you?

> {
>   if ($scalar eq $array[$i]) #here is my problem, is $scalar PART of
> @array??? not "eq" ??? only PART of ...

create a hash and check for the hash key [see below]


>   {
>   do something here
>   }
>   else
>   {
>   do some other things here
>   }
>   $i++;
> }
> 

my @array=(1,2,3,4,5);
my %hash;
@hash{@array}=();
foreach my $number (1,3,5,7,9){
   print "$number is a part of ".join (',',@array)."\n" if exists
($hash{$number});
}

HTH,
Dominik



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

Date: Sun, 27 Oct 2002 14:44:30 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Newbie-Qeustion
Message-Id: <iZSu9.22968$iV1.11633@nwrddc02.gnilink.net>

Marek Stepanek wrote:
> I want to do something, if $scalar is PART of my array ... I am
> reading in a FILE, which gives me a Line-by-Line-Scalar. I need to
> know, whether it is contained in my @array.

That's actually a frequently asked question, please see "perldoc -q
contains":

Found in e:\MSN8Main\tools\x86\perl\lib\pod\perlfaq4.pod
  How can I tell whether a list or array contains a certain element?
            Hearing the word "in" is an *in*dication that you probably
            should have used a hash, not a list or array, to store your
            data. Hashes are designed to answer this question quickly and
            efficiently. Arrays aren't.
[Rest of the FAQ snipped]


jue




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

Date: 27 Oct 2002 15:09:43 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Newbie-Qeustion
Message-Id: <apgvjn$1dv53$1@fu-berlin.de>

Marek Stepanek <mstep@t-online.de> wrote:

> my @array = (a,b,c);

imagine you change the array to the names of the months, like
my @array = (sep, oct, nov);
now print the array to see what's in it. oops - where
has october gone?
enable warnings (-w or use warnings), then
this won't happen again.
write:
 my @array = qw(a b c);
or
 my @array = ("a", "b", "c");

perldoc perlsyn
hth, tina
-- 
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception


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

Date: 27 Oct 2002 15:16:25 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Newbie-Qeustion
Message-Id: <aph009$1dv53$2@fu-berlin.de>

Tina Mueller <usenet@tinita.de> wrote:
> Marek Stepanek <mstep@t-online.de> wrote:
>> my @array = (a,b,c);
> write:
>  my @array = qw(a b c);
> or
>  my @array = ("a", "b", "c");

or
 my @array = "a" .. "c";
or even
 my @array = (a=>b=>c=>); # okay, use this one only for obfuscation =)
-- 
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Sun, 27 Oct 2002 15:46:56 GMT
From: echang@netstorm.net (ebchang)
Subject: Off topic Was Re: Before I buy the Book ...
Message-Id: <Xns92B46DB4595Fechangnetstormnet@207.106.92.86>

Desmond Coughlan <pasdespam_desmond@zeouane.org> wrote in
<slrnarm7s5.1hge.pasdespam_desmond@lievre.voute.net>: 

>Le Sat, 26 Oct 2002 17:47:31 -0500,  brian d foy <comdog@panix.com> a
>écrit : 
>
>{ snip }
>
>>> With respect, I have apologised and shall not do so again.  If you
>>> consider 'shit' to be 'obscene and highly offensive', then I can only
>>> assume that your native language is not English.
>
>> my native language is English,
>
>Whilst you're digging, remember how to spell 'pejorative'.
>
>{ snip remainder of agressive and unwarranted attack in wake of genuine
>  misunderstanding }

For the record, the author of the preceding article snipped out too many 
attributions.  I should get the blame for mistyping pejorative, not brian d 
foy.


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

Date: Sun, 27 Oct 2002 15:18:46 +0000 (UTC)
From: "Brian" <fatcat01010@yahoo.co.uk>
Subject: Wow
Message-Id: <aph04k$q59$1@helle.btinternet.com>

I'm new to this news group and new to Perl.  I'm hoping to learn a bit from
you guys while I'm here.  Just read this thread.  Wow.  Is all I can say.
I've never come across such bullshit in my life from a simple question.
Geeks




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

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.  

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 4034
***************************************


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