[26634] in Perl-Users-Digest
Perl-Users Digest, Issue: 8742 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 7 14:05:29 2005
Date: Wed, 7 Dec 2005 11: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 Wed, 7 Dec 2005 Volume: 10 Number: 8742
Today's topics:
Re: A simple inheritance question. (Anno Siegel)
Re: executing commands in the same shell in Windows usi xhoster@gmail.com
Re: Slice to end of array xhoster@gmail.com
Re: Slice to end of array (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Dec 2005 14:10:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: A simple inheritance question.
Message-Id: <dn6qfv$fl1$2@mamenchi.zrz.TU-Berlin.DE>
<xhoster@gmail.com> wrote in comp.lang.perl.misc:
> Don Gatlin <DG@nowhere.com> wrote:
> > Let me see if I can explain the question in a way to be sensible.
> > The code is at the bottom.
> >
> > I build an Object1 and initalise it with some data with new();
> > I make an instance of it
>
> How can "build"ing it be a different step from making an instance of it?
A strong case can be made to keep object creation and -initialization
apart in a well-built class. That would make these two different steps,
but making an instance would have to come first, "build"ing later.
In fact, Class::Std makes this distinction, and the pre-defined name
for the initialization method is indeed ->BUILD.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: 07 Dec 2005 14:52:49 GMT
From: xhoster@gmail.com
Subject: Re: executing commands in the same shell in Windows using Perl
Message-Id: <20051207095249.769$X9@newsreader.com>
Murugesh <appumail@gmail.com> wrote:
> Hi all,
> I need to execute a series a commands inside the same shell in
> Windows.As system() spaws a new shell,how can we do it.
> command1 and command2 should be executed in the same shell unlike the
> following.
> ...
> system("command1");
> system("command2");
> ...
>
> Appreciate any help on this.
How do you execute more than one command on the command line on Windows.AS?
On unix, I do:
system("command1; command2")
or
system("command1\ncommand2")
Maybe something similar will work with Windows.AS.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 07 Dec 2005 15:44:55 GMT
From: xhoster@gmail.com
Subject: Re: Slice to end of array
Message-Id: <20051207104455.098$Qz@newsreader.com>
u235321044@spawnkill.ip-mobilphone.net (Ronald Fischer) wrote:
> Given an array @x, what is the most elegant way to get a slice from index
> $n to the end of the array?
>
> My first attempt was @x[$n .. -1] failed - probably because the
> .. operator found that the rhs value was already lower than the
> lhs value and hence produced an empty range.
>
> I ended up with @x[$n .. $#x], which is not that bad, but maybe someone
> can come up with a better solution?
It is not bad in that case, but if the array you want sliced is anonymous
(or not an array at all, but rather a list), then things are much uglier.
Unfortunately, I don't know of a better way.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 7 Dec 2005 17:09:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Slice to end of array
Message-Id: <dn74vs$mkv$1@mamenchi.zrz.TU-Berlin.DE>
<xhoster@gmail.com> wrote in comp.lang.perl.misc:
> u235321044@spawnkill.ip-mobilphone.net (Ronald Fischer) wrote:
> > Given an array @x, what is the most elegant way to get a slice from index
> > $n to the end of the array?
> >
> > My first attempt was @x[$n .. -1] failed - probably because the
> > .. operator found that the rhs value was already lower than the
> > lhs value and hence produced an empty range.
> >
> > I ended up with @x[$n .. $#x], which is not that bad, but maybe someone
> > can come up with a better solution?
>
> It is not bad in that case, but if the array you want sliced is anonymous
> (or not an array at all, but rather a list), then things are much uglier.
> Unfortunately, I don't know of a better way.
my @tail = grep -- $n < 0, qw( a b c d e f g h);
works if $n is a variable (not a literal) which may be destroyed. It also
takes two looks to see what it does. Using an extra variable works always
and makes the code clearer:
my @tail = do {
my $i = 0;
grep $i ++ >= $n, qw( a b c d e f g h);
};
Both aren't entirely satisfactory.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
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 8742
***************************************