[8853] in Perl-Users-Digest
Perl-Users Digest, Issue: 2470 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 1 03:05:53 1998
Date: Fri, 1 May 98 00:00:51 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 1 May 1998 Volume: 8 Number: 2470
Today's topics:
@ARGV in Win32 <johnnie@holly.colostate.edu>
Re: @ARGV in Win32 (Martien Verbruggen)
Re: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER (Martien Verbruggen)
Re: Confusion with new warning concerning split operato (Mark-Jason Dominus)
Re: Executing a pattern match? <rjk@coos.dartmouth.edu>
Re: Hello people, want to learn Perl ? (Eric Hagen)
Re: Help Beginner Modify A Little Code (Martien Verbruggen)
How do I print an array in the format I want it? <bth@acsu.buffalo.edu>
Re: HTTP Proxy (Re: HTTP Request Headers) (Jerry LeVan)
Re: http Reg Exp <dformosa@st.nepean.uws.edu.au>
Re: Huge array/Win32::NetAdmin::GetUsers (Excession)
Re: inserting characters <rjk@coos.dartmouth.edu>
Re: Looking for an idiom (cf. Schwartzian Transform) <jdf@pobox.com>
Re: majordomo relay ?? (John Stanley)
Re: Perl compiler - I've played with it, why so slow? (Ilya Zakharevich)
Re: Perl compiler - I've played with it, why so slow? <rootbeer@teleport.com>
Re: Perl compiler - I've played with it, why so slow? <bruce@scientia.com.au>
Re: push @strArray, (24..31); <igor.k@usa.net>
Re: push @strArray, (24..31); <rjk@coos.dartmouth.edu>
Re: push @strArray, (24..31); <lloyd@zusman.net>
Re: push @strArray, (24..31); <danboo@negia.net>
Ref to an LVALUE??? I expected a simple SCALAR ref! <eryq@zeegee.com>
Re: Ref to an LVALUE??? I expected a simple SCALAR ref <rjk@coos.dartmouth.edu>
Re: Win32 Perl Compiler ? <rootbeer@teleport.com>
Win32 reading in passwords <nfreetly@ibm.net>
Re: Win32 reading in passwords <zenin@archive.rhps.org>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Apr 1998 21:07:25 -0600
From: John Blanco <johnnie@holly.colostate.edu>
Subject: @ARGV in Win32
Message-Id: <35493C6C.F175E2A1@holly.colostate.edu>
Why won't @ARGV do anything for me in Win32? I can't pass argument
into my program...this is peculiar...
- Johnnie B
------------------------------
Date: 1 May 1998 03:41:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: @ARGV in Win32
Message-Id: <6ibg9r$7nm$6@comdyn.comdyn.com.au>
In article <35493C6C.F175E2A1@holly.colostate.edu>,
John Blanco <johnnie@holly.colostate.edu> writes:
> Why won't @ARGV do anything for me in Win32? I can't pass argument
> into my program...this is peculiar...
What are you trying to do? How can we help you if you don't show us
what you tried? Some code please.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 1 May 1998 03:16:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER
Message-Id: <6iber7$7nm$2@comdyn.comdyn.com.au>
Subject: Re: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER
Don't shout please.
In article <01bd7496$80e43dc0$27bd15a5@default>,
"DAVID CHEW" <dcc1234@pacific.net.sg > writes:
> I am just wondering HOW to test my perl using
> my home computer, running on dos or windows.
Install perl on your local machine (http://www.perl.com/latest.html).
For CGI scripts, you either run a web server at home, and use that, or
you just run the scripts from the command line, using CGI.pm.
Ask in one of the comp.infosystems.www.* groups how to get and start a
HTTPD server on your machine.
> As I do not always go into this newsgroup
> would appreciate an email direct
> to dcc1234@pacific.net.sg
That's a shame. You probably won't see this answer then.
To prevent your next questions:
Perl CGI FAQ and (no offense) Idiot's guide:
http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
Section 9 of the perl FAQ:
# perldoc perlfaq9
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 30 Apr 1998 22:05:32 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Confusion with new warning concerning split operator in perl5.004
Message-Id: <6ibalc$ijk$1@monet.op.net>
Keywords: Bayreuth choreography Mauritius upsilon
In article <3548f7eb.10426307@news.metropolis.com>,
Alex Blume <ablume@80s.com> wrote:
> Use of implicit split to @_ is deprecated at test.pl line 3.
>Could anyone explain this error message to me,
Have you looked in the `perldiag' manual?
It explains all of the diagnostic messages.
>whether there is a better method to count the number of regular
>expression matches (in this case, just dashes) found in a string.
Some else asked this earlier today:
$count++ while $str =~ /.../g; # Count nonoverlapping items
$count++ while $str =~ /(?=...)/g; # Count overlapping items
If the pattern is single characters, as in your example, it's probably
cheaper to use
$count = $str =~ tr/-//;
------------------------------
Date: Thu, 30 Apr 1998 22:27:15 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: neal@make-a-store.com
Subject: Re: Executing a pattern match?
Message-Id: <35493305.3AF67E21@coos.dartmouth.edu>
[posted and mailed to original posted]
Brian Mathis wrote:
>
> Neal Kaiser wrote:
> >
> > $str = "blah blah <1> blah blah <2> blah blah";
> > I want to do something like:
> > $str=~s/<(\d+)>/system(/bin/myprog $1)/g;
>
> No problem. First, you need to break it up into multiple steps:
>
> $str = 'blah';
> $replace = `/bin/myprog $1`;
>
> $str =~ s/la/$replace/g;
>
> You need to use backticks(``) to let you capture the output of the
> program you run. You can't do it inside the s///, because it will try
> to interpret the replace string literally, but you can use a variable,
> as I have done.
Aside from the advice to use backticks, that is just wrong.
Backticks interpolate the string immediately. Your code executes the system
command as `/bin/myprog ` because $1 has not been set yet. (Of course, since
you omitted capturing parens in the regex, $1 will never be set.) The result
of calling myprog with *no argument* is saved in $replace, and is then
substituted into $str.
$str=~s/<(\d+)>/`/bin/myprog $1`/ge;
/e causes the replace string to be evaluated as a Perl expression.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 1 May 1998 05:23:07 GMT
From: ehagen@Hawaii.Edu (Eric Hagen)
Subject: Re: Hello people, want to learn Perl ?
Message-Id: <6ibm7r$fkn@news.Hawaii.Edu>
Could be an interesting study in "most common mistakes made" though.
I'm a "newbie" myself, and I laugh at scripts I made half a year ago.
I know this has been covered time and time again. BUT.
I have searched the net for a cookbook style site, while the docs are
GREAT, and there is a lot out there, I really would love to see a site
that has a starting example, then a list discussion fo the pros and cons
of the topic, and different ways of doing it.
Just my two cents,
Mike Lacey (lacey_michael_j/swby@swby.cgo.Cargill.Com) wrote:
: No commercial bias there re your consultancy business is there? <smile>....
: Actually I agree with Randal - might be a bit risky to let new perl
: programmers loose.
: Regards
: Mike
: --
: Mike_Lacey@Cargill.Com
: Randal Schwartz wrote in message <8c90orjly0.fsf@gadget.cscaper.com>...
: >>>>>> "Mattias" == Mattias Pihlstrvm <mm@c64.org> writes:
: >Mattias> I need some perl programmers to help me out, no money involved,
: just
: >Mattias> friendship, and doing things to learn from it.
: >You *definitely* don't want "first time perl people" hacking web scripts.
: >You don't. Trust me.
--
Eric Hagen "Sometimes we get lost in the darkness,
ehagen@Hawaii.Edu the dreamers learn to steer by the stars..."
"You fight for something because it is good.
Not because it stands to succeed."
------------------------------
Date: 1 May 1998 03:09:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help Beginner Modify A Little Code
Message-Id: <6ibee1$7nm$1@comdyn.comdyn.com.au>
In article <3548A734.338C@whitaker.org>,
Frank Blanchard <sendto_fb@whitaker.org> writes:
> the script returns data from a pipe
> delimited ascii database. the results
What's that? Do you mean something like:
foo|bar|baz
baz|bar|foo
?
> print as a table row. i want to change
> the results to a vertical list. any
> suggestions?
>
> thanks.
> -fb
> ====================================================
> $search_results .= "<TR>";
> $hit_counter = "1";
> foreach $field (@row)
> {
> $search_results .= "<TD>$field</TD>";
> }
> $search_results .= "</TR>";
> }
> ====================================================
If you mean that instead of printing 'row' by 'row', you want to print
the rows vertically from left to right, then you just need to loop
differently. Up there, you're looping over all the rows, doing
something with each row. Just loop over the fields, doing something to
all the nth elements in the rows.
Probably you should store the data in a list of lists.
# perldoc perldata
# perldoc perllol
# perldoc perldsc
This might be a way:
#!/usr/local/bin/perl -w
use strict;
# This will be an array of array refs. Each element represents a
# 'field'. Each element in the referred to list represents a 'row'
# value.
my @data = ();
while (<DATA>)
{
chomp;
my @fields = split /\|/;
# You might need to add some code to check that all the 'rows;'
# have the same number of fields.
for (my $i = 0; $i <= $#fields; $i++)
{
push @{$data[$i]}, $fields[$i];
}
}
foreach my $field (@data)
{
foreach my $row_val (@$field)
{
print "$row_val ";
}
print "\n";
}
__DATA__
1|foo|bar|baz
2|aaa|bbb|ccc
3|ddd|eee|fff
OUTPUT
1 2 3
foo aaa ddd
bar bbb eee
baz ccc fff
I'll leave it up to you to put the HTML in there.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Fri, 1 May 1998 01:42:29 -0400
From: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: How do I print an array in the format I want it?
Message-Id: <Pine.GSO.3.96.980501013433.16455B-100000@xena.acsu.buffalo.edu>
I have a Question on how to format my array to print the way I want it
to...
I had a variable $string which I parsed apart by commas into an array
using the split command
Suppose I have an @array that contains these elements. Now most of them
are just seperate elements, but there are some that are supposed to be
grouped together for printing purposes. Let me show you an example of what
I mean.
suppose an array @info contains the following string :
231 Hello 43 (big: medium: small) (right: wrong)
What I want to do is print it out so that anything inside the () is
printed in column, parsed by colons. The output would look like:
231 Hello 43 big right
medium wrong
small
How do I do this? Should I join() the elements back into a string and then
do something with that?
Any help would be MUCH appreciated.
Thanks.
Bryan H
PS- thanks again to all of you who have helped me in the past
------------------------------
Date: 30 Apr 1998 22:33:09 -0400
From: levan@hawk.eku.edu (Jerry LeVan)
Subject: Re: HTTP Proxy (Re: HTTP Request Headers)
Message-Id: <6ibc95$cj2$1@hawk.eku.edu>
In article <MPG.fb273275033922f989682@news.min.net>,
John Porter <jdporter@min.net> wrote:
>On Thu, 30 Apr 1998 15:34:49 GMT, in article
><3548996d.16209265@news.digex.net>, webmaster@gardenweb.com wrote:
>> I need to see the request headers for an HTTP request EXACTLY as the
>> browser sends them. It is a little beyond my ken to make a faux server
>> that can record them.
>>
>> Does anyone know of a script or a site that might be able to show me
>> exactly what Netscape sent the server?
>
>Sounds like you want a simple proxy server.
>
>So, can anyone supply a pointer to a proxy server written in perl?
>It must not be hard to do, what with all the great support modules
>available... but there doesn't seem to bee a "cookbook" way
>mentioned in the module docs.
>
>John Porter
There is a simple perl proxy http server (phd) and a perl web server (mhttpd) located
at <http://eagle.eku.edu:4000/PERL/>. The web server can be set to log all
of the incoming headers.
--Jerry
levan@eagle.eku.edu
------------------------------
Date: 1 May 1998 05:13:02 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: http Reg Exp
Message-Id: <893999582.922296@cabal>
In <6i8p10$ee1$1@csnews.cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting sent to cited author via email]
>In comp.lang.perl.misc,
>:These are not URLs. urls start with <URL: and end with a >
>Really? How come netscape, lynx, mosaic, and lwp all fail to handle
>them then? More importantly, what schema type is URL: supposed to be?
Ok, I should have rephrased that, "These are not URLs, urls _in free
text_ start with <URL: and end with a >"
--
I'm a perl programer if you need perl programing hire me.
Please excuse my spelling as I suffer from agraphia see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Fri, 01 May 1998 06:49:29 GMT
From: daclay@NOSPAMzip.com.au (Excession)
Subject: Re: Huge array/Win32::NetAdmin::GetUsers
Message-Id: <354a6f45.4793871@news.zip.com.au>
On Thu, 30 Apr 1998 13:41:27 -0400, "John Felso" <jfelso@att.com> wrote:
>Does anyone have experience handling really really large arrays? I need to
>use the Win32::NetAdmin::GetUsers command to get a list of users on a large
>domain. Unfortunately their is not way to retrieve one user at a time (as
>far as I know anyway). Since the GetUsers routine fills an array with all
>users at once, my script fails with an "Out of memory!" message. Here is the
>code:
I get 'out of memory' errors when I try to drill 'too deep' into an NTFS
directory structure from PERL -- there are limits to the size of various
things, one of those being the length of a path (255 characters?)
(On a 256MB system, with 512MB of swap space, and only 20% of RAM in use,
it's definitely not a case of 'out of memory' but rather an 'exceeded some
O/S limit' error).
You didn't state where abouts your code actually dies.
>require "NT.ph";
>use Win32::NetAdmin;
>Win32::NetAdmin::GetDomainController('', 'DOMAIN', $dc) || die;
>print "$dc\n";
>Win32::NetAdmin::GetUsers($dc,&FILTER_NORMAL_ACCOUNT,\@userArray) || die;
>foreach $user (@userArray) {
> print "$user\n";
>}
Is it in the GetDomainController part, or the GetUsers part?
I've had arrays with >750,000 elements, using up more than 70Mbytes, and
not had a problem with PERL under Win32. I doubt that you have >25,000
users in the NT Account database.
Check out Mr Roths updated NetAdmin stuff; that might help too.
Dac
---
David Andrew Clayton # Please remove NO_SPAM when
dac@NOSPAM.pcug.org.au # sending email replies.
I post therefore I am. #
------------------------------
Date: Thu, 30 Apr 1998 22:11:03 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: inserting characters
Message-Id: <35492F39.4ED51058@coos.dartmouth.edu>
Jeff McCreary wrote:
>
> Is there a way to insert a "/" into the middle of a string without
> trying to concantenate substrings?
substr($string, length($string)/2, 0) = '/';
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 30 Apr 1998 23:55:50 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <somuvbc9.fsf@mailhost.panix.com>
Dan Boorstein <danboo@negia.net> writes:
> Jonathan Feinberg wrote:
> >
> >
> > @stuff =
> > map { $_->[2] }
> > sort { $a->[1] cmp $b->[1] or $a->[0] <=> $b->[0] }
> > map { /^(\d*)(.+)$/; [ $1 || -1, $2, $_ ] } @stuff;
> >
> > Notice that if there's no digit, I want it to come before even a 0
> > word, so I give it a -1 value.
>
> don't '0's (as in '0Foo') become -1 as well?
Good call. Replace "$1 || -1" with
length $1 ? $1 : -1
or some such construct.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 1 May 1998 02:25:04 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: majordomo relay ??
Message-Id: <6ibbq0$h87$1@news.NERO.NET>
In article <35491C2F.7A77@ix.netcom.com>,
Dale Phillips <dphi@ix.netcom.com> wrote:
>help ...
>
>Is this news group relayed by some kind and friendly perl hacker?
No. Me.
---------
This is an automated reply to your mail to Perl-Users-Request. If you
are reporting a problem to the maintainer of the list, please be
patient, he has gotten a copy of your mail and will deal with it as
soon as he reads it.
If you are trying to sub or unsub, read on...
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.
------------------------------
Date: 1 May 1998 02:01:46 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl compiler - I've played with it, why so slow?
Message-Id: <6ibaea$ifi$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Barry Roomberg
<broomberg@nospam-ccgroupnet.com>],
who wrote in article <354929cf.50595583@netnews.voicenet.com>:
> The compiled one is slower and MORE CPU consumptive!
>
> Is this a bad test, or am I being silly here, expecting
> it to get either faster or less CPU consumptive?
You are silly :-(.
> It fully eats an UltraSparc 300 the entire run time,
> never bottlenecking on disk.
>
> Is the compiler merely a wrapper around the interpreter?
No.
> What's the purpose, other than obscuring the source code?
It is a first step only. The purpose it to expose it to general
public, which will immediately start hacking it to make it much much
better (this is just an opinion of an unwashed me).
Ilya
------------------------------
Date: Fri, 01 May 1998 02:29:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Barry Roomberg <broomberg@nospam-ccgroupnet.com>
Subject: Re: Perl compiler - I've played with it, why so slow?
Message-Id: <Pine.GSO.3.96.980430192549.8307s-100000@user2.teleport.com>
On Fri, 1 May 1998, Barry Roomberg wrote:
> Subject: Perl compiler - I've played with it, why so slow?
> The compiled one is slower and MORE CPU consumptive!
Did somebody tell you that compiling Perl will necessarily improve its
speed and efficiency? That's not the case, as you discovered. perl is
already (roughly) as fast and efficient as Perl can be. There's more good
information about this in the Perl FAQ. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 01 May 1998 15:30:47 +1000
From: Bruce Woodward <bruce@scientia.com.au>
To: Barry Roomberg <broomberg@nospam-ccgroupnet.com>
Subject: Re: Perl compiler - I've played with it, why so slow?
Message-Id: <35495E07.9EC48B56@scientia.com.au>
Hi Barry,
Had you already executed a perl script before doing this test? What I'm
really asking is was the perl interupter mainly in the buffer cache, while
the executable had to be loaded from disk. This really wouldn't explain
all the difference times in my opinion.
Bruce
Barry Roomberg wrote:
> This program reads about a 100MB of
> data, unpacks each record into about
> 100 fields, and run a loop displaying
> the field with the field name in front
> of it.
>
> Seems to me the perfect text processing type of
> app to test the compiler against.
>
> Here's what happens:
>
> $ time bad_dump.pl >/dev/null
>
> real 2m6.86s
> user 2m5.22s
> sys 0m1.50s
>
> $ time bad_dump >/dev/null
>
> real 3m1.10s
> user 2m56.17s
> sys 0m1.47s
>
> The compiled one is slower and MORE CPU consumptive!
>
> Is this a bad test, or am I being silly here, expecting
> it to get either faster or less CPU consumptive?
> It fully eats an UltraSparc 300 the entire run time,
> never bottlenecking on disk.
>
> Is the compiler merely a wrapper around the interpreter?
>
> What's the purpose, other than obscuring the source code?
>
> Brown-nosing note to the Perl Gods: I've been responsible
> for at least 20 copies of the PERL and Llama books being sold,
> since I'm a PERL evangelist in a MF/COBOL soon to be Unix/Perl
> shop. Also, whenever I consult, I demand they buy multiple Camels
> so there is always one wirthin reach when I visit, and then leave them
> there to spread the word.
------------------------------
Date: Thu, 30 Apr 1998 19:04:02 -0700
From: "Igor Krivokon" <igor.k@usa.net>
Subject: Re: push @strArray, (24..31);
Message-Id: <6ibacn$ar7$1@news.ncal.verio.com>
Bill 'Sneex' Jones wrote in message <354926AA.3AA50BF4@fccjmail.fccj.org>...
>Given -
>
>my @strArray = (21..39);
>push @strArray = (90..121);
>push @strArray = (299..310);
>
>
>Is there a better way???
>
my @strArray = (21..39, 90..121, 299..310);
Igor Krivokon
<igor.k@usa.net>
"Anyway's the only way" (T.Waits)
------------------------------
Date: Thu, 30 Apr 1998 22:50:23 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: push @strArray, (24..31);
Message-Id: <35493872.F885A7BE@coos.dartmouth.edu>
Bill 'Sneex' Jones wrote:
>
> Given -
>
> my @strArray = (21..39);
> push @strArray = (90..121);
> push @strArray = (299..310);
>
> Is there a better way???
Well, I suppose syntactical correctness would be a better way... ;-)
[Type of arg 1 to push must be array (not list assignment)]
But why not one line?
my @strArray = (21..39, 90..121, 299..310);
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 30 Apr 1998 22:53:20 -0400
From: Lloyd Zusman <lloyd@zusman.net>
Subject: Re: push @strArray, (24..31);
Message-Id: <ltaf92bt27.fsf@zusman.net>
"Igor Krivokon" <igor.k@usa.net> writes:
> Bill 'Sneex' Jones wrote in message <354926AA.3AA50BF4@fccjmail.fccj.org>...
> >Given -
> >
> >my @strArray = (21..39);
> >push @strArray = (90..121);
> >push @strArray = (299..310);
> >
> >
> >Is there a better way???
> >
>
>
> my @strArray = (21..39, 90..121, 299..310);
And furthermore, the two `push' statements you used in your example
happen to not be syntactically correct. In order for them to be
accepted by the Perl interpreter, they would have to be written thus:
push @strArray, (90..121);
push @strArray, (299..310);
or thus:
push @strArray, 90..121;
push @strArray, 299..310;
or thus:
push @strArray, (90..121), (299..310);
or thus:
push @strArray, 90..121, 299..310;
or thus:
push(@strArray, (90..121));
push(@strArray, (299..310));
or ... etc.
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: Thu, 30 Apr 1998 22:01:19 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: push @strArray, (24..31);
Message-Id: <35492CEF.36B95F16@negia.net>
Bill 'Sneex' Jones wrote:
>
> Given -
>
> my @strArray = (21..39);
> push @strArray = (90..121);
> push @strArray = (299..310);
>
do you mean:
my @strArray = (21..39);
push @strArray, (90..121);
push @strArray, (299..310);
if that's all you want to do you can separate the ranges with commas:
my @strArray = (21..39, 90..121, 299..310);
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: Thu, 30 Apr 1998 23:23:46 -0400
From: Eryq <eryq@zeegee.com>
Subject: Ref to an LVALUE??? I expected a simple SCALAR ref!
Message-Id: <35494042.4CE0A7D7@zeegee.com>
Using 5.00401 on Linux, and 5.00404 on HP/UX:
Somehow, on occasion (not always) the code...
sub var {
my ($self, $var, $val) = @_;
if ($val) {
print "REF is " . ref(\$val) . "\n";
}
}
When invoked as:
$obj->var(@twoValues);
Prints:
REF is LVALUE
Though *normally* it prints "REF is SCALAR". The $val holds
a normal scalar value, like 'FOO'.
What's going on? I've never seen a ref to an LVALUE before... where
do they come from, in this case?
This is kind of an urgent plea, since LVALUE-refs are not
handled by Storable::. I understand that there were once some
Perl bugs related to lvalues that were fixed, but I tried
this under 5.00404 and got the same result as 5.00401.
TIA,
--
___ _ _ _ _ ___ _ Eryq (eryq@zeegee.com)
/ _ \| '_| | | |/ _ ' / President, Zero G Inc: http://www.zeegee.com/
| __/| | | |_| | |_| |
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: Fri, 01 May 1998 00:19:13 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Ref to an LVALUE??? I expected a simple SCALAR ref!
Message-Id: <35494D4A.CA92C5B2@coos.dartmouth.edu>
Eryq wrote:
>
> What's going on? I've never seen a ref to an LVALUE before... where
> do they come from, in this case?
\substr($_, 1, 4) is a ref to an LVALUE. There are probably other expressions
which return LVALUE refs. [1]
I can't tell you more without seeing your more of your code.
[1] For example:
DB<1> $str = 'abcdefg'
DB<2> $ref = \substr $str, 2, 3
DB<3> x $ref
0 LVALUE(0x10104b2c)
DB<4> x $$ref
0 'cde'
DB<5> $$ref = '!'
DB<6> x $$ref
0 '!'
DB<7> x $str
0 'ab!fg'
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 01 May 1998 02:24:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Deva Seetharam <devs@usa.net>
Subject: Re: Win32 Perl Compiler ?
Message-Id: <Pine.GSO.3.96.980430192420.8307r-100000@user2.teleport.com>
On Thu, 30 Apr 1998, Deva Seetharam wrote:
> Is there any perl compiler for windows ?
The Perl FAQ talks about this. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 01 May 1998 00:35:28 -0500
From: Neil Freetly <nfreetly@ibm.net>
Subject: Win32 reading in passwords
Message-Id: <35495F1F.B48573BC@ibm.net>
How can I accept input from the keyboard without displaying it to the
screen?
For instance, I want to prompt for a password in my WIN32 Perl program,
but I don't want to echo to the screen what the user types in. Any
Ideas?
------------------------------
Date: 1 May 1998 06:24:18 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Win32 reading in passwords
Message-Id: <894004307.98660@thrush.omix.com>
Neil Freetly <nfreetly@ibm.net> wrote:
: How can I accept input from the keyboard without displaying it to the
: screen?
:
: For instance, I want to prompt for a password in my WIN32 Perl program,
: but I don't want to echo to the screen what the user types in. Any
: Ideas?
Untested, but if I remember my batch commands correctly:
system ("@echo off");
print "Please enter your password: ";
chomp $pass = <STDIN>;
system ("@echo on");
There probably is a module that does this in a more platform
independent way. Check CPAN.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2470
**************************************