[18212] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 380 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 28 21:05:51 2001

Date: Wed, 28 Feb 2001 18:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983412317-v10-i380@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 28 Feb 2001     Volume: 10 Number: 380

Today's topics:
    Re: Bug report: splice/stringification (Martien Verbruggen)
    Re: Display Delay in Perl? <mjcarman@home.com>
    Re: Display Delay in Perl? (Abigail)
    Re: Display Delay in Perl? <godzilla@stomp.stomp.tokyo>
    Re: Display Delay in Perl? <peter.sundstrom-eds@eds.com>
    Re: Excluding commented lines from a grep search nobull@mail.com
    Re: Excluding commented lines from a grep search <c_clarkson@hotmail.com>
    Re: Glob & long directory names <bart.lateur@skynet.be>
    Re: Help deciphering Perl code <bart.lateur@skynet.be>
    Re: How are SOL_SOCKET and SO_REUSEADDR defined in vari <barmar@genuity.net>
    Re: How the C L P M turns <godzilla@stomp.stomp.tokyo>
    Re: How the CLPM turns (Randal L. Schwartz)
    Re: How the CLPM turns <godzilla@stomp.stomp.tokyo>
    Re: Is there A Perl "wrapper" for windows/Apache?? (Damian James)
    Re: Learning Perl and I need help. <bart.lateur@skynet.be>
    Re: May Be [ Off Topic ] <bart.lateur@skynet.be>
    Re: Need help with an array... nobull@mail.com
    Re: Need help with an array... <wyzelli@yahoo.com>
    Re: Need help with an array... <bart.lateur@skynet.be>
    Re: not sure to post it here nobull@mail.com
    Re: Opening STDERR for input nobull@mail.com
    Re: Opening STDERR for input <krahnj@acm.org>
    Re: Perl string <tlav1@mediaone.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 01 Mar 2001 01:29:07 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Bug report: splice/stringification
Message-Id: <slrn99r9f3.vg.mgjv@verbruggen.comdyn.com.au>

On Wed, 28 Feb 2001 10:19:26 GMT,
	Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Gwyn Judd <tjla@guvfybir.qlaqaf.bet>
> say such a terrible thing:
>>I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
>>say such a terrible thing:
>>>To the p5p and anyone connected with perl.com:
>>
>>Just FYI. I forwarded your message in it's entirety to the perlbug
>>address.
> 
> Ya filthy spammer ;)

It wasn't me! 

I don't even own a site with freely downloadable cracked versions of
commercial software. I also don't really know about a working pyramid
scheme, and I don't know how to add inches to your penis. Furthermore,
I can't help you get rich, tell you about the latest conspiracy of the
government and aliens, explain where to get the hottest pictures, give
you a free satellite receiver, advice you on the best mobile phone
deals, promote your business success by selling you a CD with
millions of email addresses, tell you how to set up your WAP site,
sell you a car, reveal to you how I became a millionaire, make you
lose 4 to 6 inches of stubborn stomach fat in only 23 days, offer you
a time-share apartment in Mallorca, help you get smart in less than 3
months, send you unparseable HTML or viral attachments, offer you a
loan without a hassle, offer you a job, sell you cosmetics that will
make those pesky wrinkles go away forever, give you a credit card with
an excellent credit rating, make your hair grow back by selling you a
hair follicle stimulator for men and women, solve your mortgage
problems, write in taiwanese to send you some stuff that you are very
unlikely to ever decode successfully, offer you an income of over
$1000 a day for just sitting on your lazy bum, at home, and not doing
a thing except pick up the phone now and again, give you a free
Motorola pager if you sign up with my paging service, talk to you
about god, send you more unreadable HTML, tell you how to be a
success, tell you about designer clothing or offer you free web
resources.

Did I mention that I can't tell you how to get rich?

If I could, I'd be rich, and not here.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 28 Feb 2001 16:06:17 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Display Delay in Perl?
Message-Id: <3A9D7659.ACBFAD81@home.com>

[Apologies if anyone sees two posts -- I banged a wrong key and the
first one dissapeared into the ether.]

Ranjithalingam Camalalingam wrote:
> 
> How do i delay print an output?(in monitor)
> say i want to print "Hello World!";

Use sleep() to delay program execution.
 
> I want each letter in "Hello World" to appear after 1 second delay.

To print out partial lines, you'll want to set $| for force autoflushing
of the output (instead of buffering).

#!/usr/local/bin/perl5 -w
use strict;

my $message = "Hello, World!\n";
$| = 1;

foreach (split //, $message) {
    print;
    sleep 1;
}

-mjc


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

Date: 28 Feb 2001 23:48:40 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Display Delay in Perl?
Message-Id: <slrn99r3io.hu2.abigail@tsathoggua.rlyeh.net>

Ranjithalingam Camalalingam (ranch@lager.engsoc.carleton.ca) wrote on
MMDCCXXXVIII September MCMXCIII in <URL:news:97jr5h$etq$1@bertrand.ccs.carleton.ca>:
{} Hi Friends,
{} 
{} How do i delay print an output?(in monitor)
{} say i want to print "Hello World!";
{} 
{} I want each letter in "Hello World" to appear after 1 second delay.
{} Example:
{} 
{} Sec.	Letter
{} 1	H
{} 2	He
{} 3	Hel
{} 4	Hell
{} 5	Hello
{} and so on...
{} Please Help Me out!

Turn buffering off:

perl -we '$| = 1; map {sleep print} "Hello" =~ /./g'



Abigail
-- 
perl -swleprint -- -_='Just another Perl Hacker'


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

Date: Wed, 28 Feb 2001 15:53:41 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Display Delay in Perl?
Message-Id: <3A9D8F85.C91DB4AF@stomp.stomp.tokyo>

Ranjithalingam Camalalingam wrote:

> How do i delay print an output?(in monitor)
> say i want to print "Hello World!";

(snipped)

Use of sleep is one alternative as discussed
by others. There is another method which allows
better resolution of time and does not require
an autoflush call.

  select  undef, undef, undef, (time delay);

or:

  select  undef, undef, undef, undef, (time delay);


For clarity, this is a full example with a 1.75 second delay,

  select  undef, undef, undef, 1.75;


Use of select is supported by many systems
but not all systems. You will need to test.

Following my signature you will read a test
script with which you may play to discover
how this works.

Godzilla!
--


#!perl

print "Content-type: text/plain\n\n";

@Array = (1 .. 10);

@Delay = qw (.10 .25 .50 .75 1 1.10 1.25 1.5 1.75);

$control = $#Array;

for ($iterate = 0; $iterate <= $control; $iterate++)
 {
  print "$Array[$iterate] ";
  select  undef, undef, undef, $Delay[rand(@Delay)];
 }

exit;


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

Date: Thu, 1 Mar 2001 11:17:18 +1300
From: "Peter Sundstrom" <peter.sundstrom-eds@eds.com>
Subject: Re: Display Delay in Perl?
Message-Id: <97jtde$77t$1@hermes.nz.eds.com>


"Ranjithalingam Camalalingam" <ranch@lager.engsoc.carleton.ca> wrote in
message news:97jr5h$etq$1@bertrand.ccs.carleton.ca...
> Hi Friends,
>
> How do i delay print an output?(in monitor)
> say i want to print "Hello World!";
>
> I want each letter in "Hello World" to appear after 1 second delay.
> Example:
>
> Sec. Letter
> 1 H
> 2 He
> 3 Hel
> 4 Hell
> 5 Hello
> and so on...
> Please Help Me out!

perldoc -f sleep




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

Date: 28 Feb 2001 23:42:14 +0000
From: nobull@mail.com
Subject: Re: Excluding commented lines from a grep search
Message-Id: <u9d7c28je1.fsf@wcl-l.bham.ac.uk>

"Jose Acosta" <jose.acosta@intel.com> writes:

> I am trying to grep for certain lines in a file containing a certain word
> but would like to exclude lines that are commented out.  In the following
> example I want to retrieve the first five rows but not the sixth since it is
> commented out.  I am then placing the third column, which is the name of the
> printer, into an array for processing.  Can anybody help me figure out how
> to exclude this line.  The code I have does not recognize the line with the
> # sign in front so I cannot even do an if statement checking to see if the #
> sign appears.

Huh?  That statement makes no sense.  What did you mean to say?

The code you have does not recognise the # sign because if makes no
effort to do so.  If the code you had did something to look for an #
sign then it _would_ recognise the # sign.

> chomp(@prclst = `cat $prclst`);

Ouch - see FAQ: "How can I read in an entire file all at once?"

> `echo "a is" >> $maxDir/$me.lastrun`;

Ouch - see FAQ: "What's wrong with using backticks in a void context?"

> `echo @a >> $maxDir/$me.lastrun`;

Ouch - if you want to program in shell why are you using Perl at all?


-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 28 Feb 2001 19:07:59 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Excluding commented lines from a grep search
Message-Id: <87EF71667A20712A.C7C5B4DD3450AC4E.0B7A69BCF372B679@lp.airnews.net>


"Jose Acosta" <jose.acosta@intel.com> wrote in message
news:97jpim$ko0@news.or.intel.com...
: I am trying to grep for certain lines in a file containing a certain word
: but would like to exclude lines that are commented out.  In the following
: example I want to retrieve the first five rows but not the sixth since it
is
: commented out.  I am then placing the third column, which is the name of
the
: printer, into an array for processing.  Can anybody help me figure out how
: to exclude this line.  The code I have does not recognize the line with
the
: # sign in front so I cannot even do an if statement checking to see if the
#
: sign appears.  I think it is seeing it as a comment but I am not sure.
:
: FILE:
: BG!int4100tcp!tictest1!chdigi01!2102!5
:
: BG!int4100tcp!tictest2!chdigi01!2103!5
:
: BG!int4100tcp!tictest3!chdigi01!2104!5
:
: BG!int4100tcp!tictest4!chdigi01!2105!5
:
: BG!int4100tcp!tictest5!wrxlabdp!2102!5
:
: #BG!int4100tcp!tictest6!wrxlabdp!2102!5
:
: CODE:
:
: chomp(@prclst = `cat $prclst`);
:
: @command=(grep(/int4100tcp/, @prclst));

    how about:
    @command = grep /^.{3}int4100tcp/, @prclst;
or
    @command = grep /int4100tcp/ && !/^#/, @prclst;

HTH,
Charles K. Clarkson





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

Date: Thu, 01 Mar 2001 00:59:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Glob & long directory names
Message-Id: <ql7r9torculp6rj2dhdi9hhvei7vljqbgv@4ax.com>

Soren Andersen wrote:

>the answer might be (and 
>BTW your prob with glob is something I hadn't stumbled across) the Win32 module  
>subroutine Win32::GetLongPathName, which will return the LFN of any DOS 8.3 
>name (real name -- the file/dir has to actually exist -- this actually checks 
>the physical filesystem unlike most such similar-seeming routines in other 
>File:: modules) fed to it.

Wow. I wonder how they do it. One thing's for sure: this function is NOT
in the Win32 API. I know you can use a DOS INT call on Win95, but that
doesn't work on NT. And here, it's a bult-in?!? I really hope that this
*does* work on NT.

-- 
	Bart.


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

Date: Thu, 01 Mar 2001 00:46:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Help deciphering Perl code
Message-Id: <q56r9t8gtbvojl58v6pg4sirmi23ta8ros@4ax.com>

Falc2199 wrote:

>The following code selects a line randomly from a file....
>
>while (<FILE>)
>{
>  if (rand($.) < 1) 
>{
>   $line = $_;
>}
>
>}
>
>Can someone please explain to me how this code is working? 

Induction: let's assume that at the time we get at line n, the
probability for each of the (n-1) previous lines of having been
selected, is the same for all, thus: 1/(n-1).

The probability of line n replacing that line, is 1/n. Thus, the
probability that the previous selection still holds, is (n-1)/n. After
this, each of the (n-1) first lines, and line n, all of them have an
equal probability, 1/n, for being selected.

After line 1, a probability of one makes it a certainty that after one
line, it got selected. Thus, the initial assumption holds.

Continuing from there on: we get at line 2, with a 1 in 2 chance of
replacing the selection. Therefore, line 1 has 1 chance in 2 of staying
in. Line 3: a 1 in 3 chance of becoming the new selection, a 2 in 3
chance that either line 1 or line 2 is still there; that makes a 1 in 3
chance for each line. Etc, QED, blah blah blah.

-- 
	Bart.


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

Date: Thu, 01 Mar 2001 01:07:17 GMT
From: Barry Margolin <barmar@genuity.net>
Subject: Re: How are SOL_SOCKET and SO_REUSEADDR defined in various flavors of Unix?
Message-Id: <9hhn6.27$5t5.30758@burlma1-snr2>

In article <97h9bs$9r8$1@yin.interaccess.com>,
Kenny McCormack <gazelle@interaccess.com> wrote:
>The real situation is that I want my application to work on machines where,
>in your opinion, the Perl installation is "broken".  I can assume the
>existence of the Perl executable, but nothing more.
>
>Seems clear enough to me.  But this *is* the sort of thing that makes people
>want to write stuff in C, and not dick around with scripting languages.

You really think that a site that can't manage to install Perl properly
will be able to compile a C program?  What makes you think they'll even
have a C compiler available?  And wouldn't you then have to dick around
with things like autoconf to ensure portability to all the different
flavors of Unix?  Or would you give up on portability and just ship binary?

Maybe the solution for your problem is to write the script in perl, and
have it read the appropriate header files in /usr/include to find the
values.

-- 
Barry Margolin, barmar@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


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

Date: Wed, 28 Feb 2001 15:06:56 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How the C L P M turns
Message-Id: <3A9D8490.4D6755FD@stomp.stomp.tokyo>

My apologies if this posts twice. I having some difficulties
slipping this subject title past Suckernew's spam filters.

**


Randal L. Schwartz wrote:
 
> mothra wrote:

(snippage)
 
> > How to spell check a textform field

> Hmm.  An idea for a snippet, but perhaps not a full program,
> so I'll file this in the "when I'm doing things to a form, what's
> one of them".
 
Back in 1991, when you and myself were teenagers and the better
qualities of these other yahoos were sheet wet spots, I purchased
a piece of software, "Writer's Toolkit," available only on ten
old fashion floppy disks, the 3.5 inch variety. Boggles me to
think I still have some 5.25 inch truly floppy disks.

Although antiquated and intended for Windows 3.1 and early
Windows 95, I do run this software on my new Pentium 3 class
machine. This software includes a Grammar Checker, a Spell Checker,
a Dictionary, a Thesaurus, a Knowledge Base, a Handbook Of Writing
Mechanics, Quotes and an Abbreviation Guide. It is a very decent
bit of software with extensive abilities.

What I enjoy the most, is its Grammar Checker. By default, this
software sets standardized grammar rules for writing styles
including, Business, Technical, Fiction, Academic, Legal, Formal,
Informal and user configurable rules for custom grammar checking.

You will note, this Writer's Toolkit includes a grammar checker
for Technical writings.

A truly valuable Perl module would be a grammar checker along the
lines of my Writer's Toolkit although this would be a module rarely
used by Perl Techno-Geeksters.

Randal, why don't you write a Grammar module so I can rip it
off and use it for my androids?

My Roberta The Remarkable Robot is now 1200 lines of Perl code
supported by over a gigabyte of data bases. Linking Roberta to her
databases is not a problem. However, more than half of her main
program is dedicated to grammar checking and writing mechanics.
Even so, she still creates, at times, on-the-fly, some of the 
most wanged out crazy statements you could ever read, all perfectly
grammatically correct and highly logical yet so strange as to cause
me to tug at my dyed black corkscrewy hair. She is a cute one
capable of very clever conversation.

Writing a grammar rule book, writing a mechanics of writing rule
book, is exceptionally challenging, seemingly an impossible task
to ever perfect to degree which complies with an English teacher's
inhuman expectations, even more inhuman considering my personality.

You are a talented Perl programmer Randal. Rather than write a
simple spell check for form textfields, write me a Grammar module.
Whatcha say?

Godzilla!


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

Date: 28 Feb 2001 16:39:12 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How the CLPM turns
Message-Id: <m1y9uq2uhb.fsf@halfdome.holdit.com>

>>>>> "Godzilla!" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

Godzilla!> Back in 1991, when you and myself were teenagers

Speak for yourself Kira.  By the end of 1991, I had turned 30, and had
been programming for over two decades.

And your PhD in English must be a bit rusty.  That'd be "when you and
*I* were teenagers", since you aren't performing an action on
yourself.  Even a simple member of the uneducated class such as me can
grok that.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 28 Feb 2001 17:16:36 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How the CLPM turns
Message-Id: <3A9DA2F4.A68B28E0@stomp.stomp.tokyo>

Randal L. Schwartz wrote:
 
> > Godzilla! wrote:
 
> Godzilla!> Back in 1991, when you and myself were teenagers
 
> Speak for yourself Kira.  By the end of 1991, I had turned 30, and had
> been programming for over two decades.

I never trust anyone over thirty.
 
> And your PhD in English must be a bit rusty.  That'd be "when you and
> *I* were teenagers", since you aren't performing an action on
> yourself.  Even a simple member of the uneducated class such as me can
> grok that.

My Grammar Checker is set for Informal Rules when I post
to USENET. I reckon yall done be one of them there city
slicker fellas with right shiny shoes and proper werds!

So, you gonna write a grammar module for me?

Godzilla!


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

Date: 28 Feb 2001 23:47:27 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Is there A Perl "wrapper" for windows/Apache??
Message-Id: <slrn99r3ep.kkg.damian@puma.qimr.edu.au>

So said 'Me' on Wed, 28 Feb 2001 08:23:30 -0800:
>
>Could anyone point me in the right direction for a perl-wrapper for Apache
>for win32?
>I found a nice wrapper, called "PerlEx". What it does is let perl.exe be
>resident in memory, thereby creating an enormous perl-execution-speed (they
>talk about 50x speed improvement) because windows doesn't need to fire-up
>...
>

I don't know about 50x, but what you're after is called mod_perl. You can 
read all about it at:

	http://perl.apache.org

For an easy installation, you may be interested in IndigoPerl, which
includes Apache and mod_perl pre-integrated:

	http://indigostar.com/indigoperl.htm

HTH

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(1){for($;=@;;--$;;){next if($:=rand($;+
1))==0+$;;@;[$;,$:]=@;[$:,$;];print "\x"for 0..2*($|+23)}print map{$;{$_}}(@|
,@;);push@|,shift@;if$;[0]==@|;last if!@;;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Thu, 01 Mar 2001 01:05:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Learning Perl and I need help.
Message-Id: <918r9tstqb4n0rkcd88jmur2d7hifo42pg@4ax.com>

Rick M wrote:

>From a shell scripter to a perl programmer in 24 hours. Not likely!
>Its tough, trying to do in Perl what I used to do in shell, but I'm not
>giving up.

Try getting your hands on "Learning Perl", AKA the "Llama book", by
Randal Schwartz. That will most definitely ease your learning curve.
Borrow it, if you don't want to spend any money.

-- 
	Bart.


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

Date: Thu, 01 Mar 2001 01:01:52 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: May Be [ Off Topic ]
Message-Id: <pq7r9tgiolnfctnbsqambs8rq1n4fkg6pm@4ax.com>

Chris wrote:

>Hi everybody, I just installed MySQL and I have heard
>that it can be linked with perl to query the database.
>Is this possible?

Yup. See the tutorial on WebMonkey.
<http://hotwired.lycos.com/webmonkey/backend/databases/tutorials/tutorial1.html>

-- 
	Bart.


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

Date: 28 Feb 2001 23:18:44 +0000
From: nobull@mail.com
Subject: Re: Need help with an array...
Message-Id: <u9itlu8kh7.fsf@wcl-l.bham.ac.uk>

u678619384@spawnkill.ip-mobilphone.net writes:

> I have an array...

>         ....and I'm trying to call it like this:

You do not "call" an array.  What is it you are actually tring to do
to the array?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 1 Mar 2001 10:18:03 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Need help with an array...
Message-Id: <eQgn6.15$2H1.2507@vic.nntp.telstra.net>

<u678619384@spawnkill.ip-mobilphone.net> wrote in message
news:l.983398385.1275115966@[207.196.68.130]...
> I have an array that looks like:
>
> but, it goes up to $webpage[21], and I'm trying to call it like this:
>
> $PageUrl  = 'http://' . $webhost . @webpage[0..21];
> $rqst = HTTP::Request->new('GET', $PageUrl);
>
> which is working only for the last URL ($webpage[21]).  Can anyone
tell me how
> to get it to do all of the webpage's?

for (0..21){
    $PageUrl .= "http://$webhost@webpage[$_]\n";
}
print $PageUrl;


> Also... It's returning all of the content in XML, does anyone know how
to just
> get it return Apparel or Auction if there's content?  Rather than all
of the
> actual content.  Thanks so much in advance...Janet (please send reply
to jgs2283@hotmail.com since I don't check newsgroups too often...)
Thanks!
>

I don't really know what you mean by 'if there's content'...

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: Thu, 01 Mar 2001 01:48:44 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Need help with an array...
Message-Id: <7f8r9t4mbnp91l3upd8bsg6om2mlf6bb9h@4ax.com>

u678619384@spawnkill.ip-mobilphone.net wrote:

>$PageUrl  = 'http://' . $webhost . @webpage[0..21];
>$rqst = HTTP::Request->new('GET', $PageUrl);
>
>which is working only for the last URL ($webpage[21]).  Can anyone tell me how
>to get it to do all of the webpage's?

It does what it does, because you have an array slice in a scalar
context. That acts as if it were a list of comma separated items, and
that throws away the results of everything butthe last item. That
explains your result. If it didn't act this way, you'd get... nothing at
all.

There's only one solution: you have a set of 22 URL's. Get them all, one
at a time.

	foreach my $page (@webpage) {
	    my $PageUrl  = "http://$webhost$page_";
	    my $rqst = HTTP::Request->new('GET', $PageUrl);
            my $res = $ua->request($req);
	    ...	
	}

>Also... It's returning all of the content in XML, does anyone know how to just
>get it return Apparel or Auction if there's content?

Nobody who isn't familiar wit hthis particular service knows. There
won't be too many who DO know it, around, I guess. Anyway, try looking
at XML::Parser and relatives, for example: XML::Simple. Both are
available on CPAN, <http://search.cpan.org/>. If you're working with a
Win32 perl, you already have XML::Parser.

-- 
	Bart.


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

Date: 28 Feb 2001 23:16:04 +0000
From: nobull@mail.com
Subject: Re: not sure to post it here
Message-Id: <u9lmqq8kln.fsf@wcl-l.bham.ac.uk>

Bill Wang <www0028@garnet.acns.fsu.edu> writes:

> Newsgroups: comp.lang.perl.misc
> Subject: not sure to post it here

Post here if and only if your question is in some whay related to the
Perl programming language and not easily answered by consulting the
standard documentation or by searching a Usenet archive of this
newsgroup.

[snip question in no way shape or form even remotely related to Perl ]

You may just as well have asked about how to cook oysters. Oysters
contain pearls. "Pearl" sounds like "Perl".  So questions about oyster
cooking are on-topic, surely?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 28 Feb 2001 23:28:03 +0000
From: nobull@mail.com
Subject: Re: Opening STDERR for input
Message-Id: <u9g0gy8k1o.fsf@wcl-l.bham.ac.uk>

Bernie Cosell <bernie@fantasyfarm.com> writes:

> On Unix, STDERR is standardly open for both reading and writing [try it
> from a shell script, for example].  I was somewhat surprised to discover
> that in Perl, STDERR is open for output-only.

This is normal.  I is the same in C.

> } open (STDERR, "+<&2") or die "Can't reopen STDERR:$!\n" ;
> 
> to no apparent avail [later in the program I try to do:
> 
> }     print STDERR "Account to connect to: \n" ;
> }     chomp ($acct = <STDERR>) ;
> 
> and the print works fine but the <> always blows up.  Is there some way to
> program around this [preferably not hugely ugly].  THANKS!

Reading from file descriptor 2 is in itself hugely ugly.

open X,"<&2";

(If you want the special STDERR filehandle to loose it's specialness
then you can undef(*STDERR) but that is really seriously ugly).

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 01 Mar 2001 00:27:27 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Opening STDERR for input
Message-Id: <3A9D98BB.5DCE6550@acm.org>

Bernie Cosell wrote:
> 
> On Unix, STDERR is standardly open for both reading and writing [try it
> from a shell script, for example].

You'll have to provide an example to substantiate this claim!


John


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

Date: Thu, 01 Mar 2001 00:43:47 GMT
From: ted <tlav1@mediaone.net>
Subject: Re: Perl string
Message-Id: <3A9DC60C.331B4931@mediaone.net>

You could try to enclose your command in the command input operator,
sometimes called the _backtick_ ( ``) operator.

`mailx name@host.com -r "login2@host.com" < filename`;

The filename might have to be the full path to the file.  This is just a
guess.  Hope it helps!

ted



Raja Banerjee wrote:

> Hi
> I am trying to run a system command like
> mailx name@host.com -r "login2@host.com" < filename
> from a perl program .
> Theproblem is with the inverted commas .I have not been able to figure
> out how to invoke it so that it works.
> Any  help appreciated
> Raja



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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