[9211] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2806 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 7 16:07:53 1998

Date: Sun, 7 Jun 98 13:00:32 -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           Sun, 7 Jun 1998     Volume: 8 Number: 2806

Today's topics:
    Re: about pipe command in win32 (Jonathan Stowe)
    Re: Am I looking at an anonymous array (Erland Sommarskog)
        anyone using the JPL? (Michael Slattery)
        automail <wolfram.oehms@metronet.de>
    Re: delete slice in list <due@murray.fordham.edu>
    Re: Existing Perl Scripts for reading emailed forms thr (Jonathan Stowe)
        Force garbage collection <plmiller@postoffice.worldnet.att.net>
    Re: forcing single line output (Michael Slattery)
    Re: Foreach Efficiency samdie@wsfd.org
    Re: Foreach Efficiency (Jonathan Stowe)
        Help with Posting Method <info@thewebmasters.bc.ca>
    Re: Help with Posting Method (Bob Trieger)
    Re: I'm having problems: <merlyn@stonehenge.com>
    Re: Is PERL case sensitive? (Craig Berry)
    Re: newbie ques:  Here Documents <timlowe@u.washington.edu>
    Re: newbie question on pattern matching (Craig Berry)
        perl-frage <wolfram.oehms@metronet.de>
        problem with LWP <tower_removethis@seanet.com>
    Re: Q: drop a 'slice' in list (Jonathan Stowe)
    Re: Q: puzzled: regex with inperpolation (Ilya Zakharevich)
    Re: Q: sorting table %book by $title (Mike Heins)
        question <wolfram.oehms@metronet.de>
    Re: question (Craig Berry)
    Re: regexp to delete trailing spaces? (Paul Buder)
    Re: Removing a character from a string <tchrist@mox.perl.com>
    Re: Use of HTML, POD, etc in Usenet (was: Re: map in vo (John Moreno)
    Re: User System Info. bobbybooby@my-dejanews.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 07 Jun 1998 19:13:33 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: about pipe command in win32
Message-Id: <357ae48f.32657031@news.btinternet.com>

On Sun, 07 Jun 1998 00:37:36 +0900, Steeven.Lee wrote :

>I debug perl on win95 with perl.exe, and I found pipe command worked
>well on unix system, but never worked under win32. Here is it:
>open (MAIL, "|$mail_program");

I would check that $mail_program contains a valid program name.

>Also some other pipe command wouldn't work either. :(
>I tried Dos-pipe command, it seems no problem.
>anyone know what's wrong? how to made it run under dos?
>
>rem:  I've installed a command-line-winmail. worked well under dos.

Fine.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 07 Jun 1998 12:25:35 GMT
From: sommar@algonet.se (Erland Sommarskog)
Subject: Re: Am I looking at an anonymous array
Message-Id: <6le0rt$86i$1@cubacola.tninet.se>

mikeh@minivend.com (Mike Heins) skriver:
>Just bless it and see if it has a package name in front.
>
>        @Main::Package::ref = 1;
>
>        my @ref;
>        @ref = 1;
>
>        $ref = [ 1 ];
>
>        for ( \@Main::Package::ref, \@ref, $ref) {
>        print "$_\n";
>        }
>
>        for ( \@Main::Package::ref, \@ref) {
>        bless $_;
>        print "$_\n";
>        }
>

The output I got I was:

   ARRAY(0x9100a8)
   ARRAY(0x9100cc)
   ARRAY(0x910198)
   main=ARRAY(0x9100a8)
   main=ARRAY(0x9100cc)

Adding $ref to the last for clause did only give:

   main=ARRAY(0x910198)

>Otherwise there would be no way to tell.

I guess if Tom Christiansen says I can't do it, that probably means I 
can't do it. (Well, I was contemplating that you could chase around
in symbol tables, but that seems like an utterly bad idea, if all I 
want to do is to avoid a warning.)

--
Erland Sommarskog, Stockholm, sommar@algonet.se
F=F6r =F6vrigt anser jag att QP b=F6r f=F6rst=F6ras.
B=65sid=65s, I think QP should b=65 d=65stroy=65d.


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

Date: Sun, 7 Jun 1998 12:56:40 GMT
From: slattery@angel.net (Michael Slattery)
Subject: anyone using the JPL?
Message-Id: <slattery-0706981356400001@mac.hardboiled.com>

Hello,

Is anyone out there using the JPL from the Perl resource kit?  

If so, please post some URL's.

Thank You.


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

Date: 7 Jun 1998 17:51:31 GMT
From: "wolfram.oehms" <wolfram.oehms@metronet.de>
Subject: automail
Message-Id: <01bd923c$c9dc6840$97a5a8c1@default>

Is there a way to send an email out to everyone who comes to our website
automatically without them filling out a form,etc... ?

Thanks
Wolfram


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

Date: 7 Jun 1998 19:42:49 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: delete slice in list
Message-Id: <6leqfp$hej$0@206.165.146.137>


Ala Qumsieh wrote in message <357ADF00.9A777EF5@matrox.com>...
>Use splice() !
>
>Xah Lee wrote:
>
>> How can I
>>  delete a sequence of elements of a **LIST** in one line? (one
semicolone)
>> To

This is the second suggestion to use slice and I still don't see it.  As
long he wants to use sort, and only have one semicolon.  He explicitly asked
for a the solution to work with a list.  From perlfunc:

Functions for real @ARRAYs
pop, push, shift, splice, unshift

Functions for list data
grep, join, map, qw/STRING/, reverse, sort, unpack

I note that
@aa = join(split, 'Dvorak keyboard is wonderful. Eh eh eh?');
runs without complaint, even though it does not help him with his task.  On
the other hand:

@aa= splice((split, 'Dvorak keyboard is wonderful. Eh eh eh?'),-3);
produces the error message:
Type of arg 1 to splice must be array (not split).

Which actually makes sense to me as the output can be an array or list of
scalars (hope I said that correctly) and splice makes no sense in a scalar
context.
so
@aa = split(m/ /,'Dvorak keyboard is wonderful. Eh eh eh?');
splice (@aa,-3);

works fine (although I would not use the m/ /) but we still have two
semicolons.
All of which leaves the original question unanswered to my way of thinking.

The closest I could come to the stated goal was:
($one,$two,$three,@aa) = reverse(split(' ','Dvorak keyboard is wonderful. Eh
eh eh?'));
print reverse @aa;
But the output needs to be reversed so still two semicolons.

Any additional edification would be appreciated.

Allan M. Due
Due@discovernet.net
Admin@WhiteCrow.net

The beginning of wisdom is the definitions of terms.
- Socrates





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

Date: Sun, 07 Jun 1998 19:13:32 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Existing Perl Scripts for reading emailed forms through POP3
Message-Id: <357ae3fb.32508404@news.btinternet.com>

On Sat, 06 Jun 1998 13:07:16 GMT, Darwin J. Sanoy wrote :

<snip>
>__________________________________
>Darwin J. Sanoy
>Principal Consultant, MCSE
                                   ^^^^^

shouldnt you know the answer then ?

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 7 Jun 1998 19:48:57 GMT
From: "Preferred Customer" <plmiller@postoffice.worldnet.att.net>
Subject: Force garbage collection
Message-Id: <6leqr9$evv@bgtnsc03.worldnet.att.net>


I am running a perl program to process a large file ( 15,000,000 records of
1000 bytes each).  I simply read a single record, process it, and write it
out to a file.  What is happening is that I get an out of memory failure. 
It appears that the arrays and hashes I am using are not being reused but
new memory is assigned for each record. Using top Isee that my address
space is approaching 2 gig when I get the out of memory message.  Is there
a way I could force garbage collection every 100,000 records?

I am using perl 5 on a Sun Solaris.

Thanks
Paul Miller
plmiller@worldnet.att.com


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

Date: Sun, 7 Jun 1998 12:51:38 GMT
From: slattery@angel.net (Michael Slattery)
Subject: Re: forcing single line output
Message-Id: <slattery-0706981351380001@mac.hardboiled.com>

In article <6laaa5$15n$1@strato.ultra.net>, sowmaster@juicepigs.com (Bob
Trieger) wrote:

> [ posted and mailed ]
> 
> ames0009@tc.umn.edu (Todd C. Ames) wrote:
> -> Is there a way to force print output (writing to a file) on a single
> -> line?  I have a tab delimited list that is very long for each entry,
> -> and each entry in the file must be on one line.  Everything I've read
> -> about using print formats and value fields has described how to split
> -> a long string, not how to force it to stay together.  
> 
> 
> huh?
> 
> output doesn't insert new line or carriage return unless you tell it to.
> 
Exactly.

1.  You may not be chomping the newlines from the source file(s)

or 

2. Is it possible that all is well, but you are reading your output in a
word processor that inserts hard returns, or fails to give you the option
of non-wrapping of long lines?


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

Date: Sun, 07 Jun 1998 14:40:06 -0400
From: samdie@wsfd.org
Subject: Re: Foreach Efficiency
Message-Id: <357adf5f$1$fnzqvr$mr2ice@news.asan.com>

In <3579ac12.83815330@news.btinternet.com>, on 06/06/98 
   at 09:17 PM, Gellyfish@btinternet.com (Jonathan Stowe) said:

>On Thu, 4 Jun 1998 20:46:26 GMT, Peter A Fein wrote :

>>I have some code that looks like: 
>>
>>foreach my $i (sort article_cmp @all_pages) {
>>do_stuff_with($i); # more or less
>>}
>>
>>My inclination is that the list-generating sort only gets done once,
>>and therfore doing it outside the loop and storing it in a variable
>>which foreach then indexes would be unnecessary.  Is this correct?
>>

>Yes.

>The syntax of this should suggest the way it works.  In most cases a ()
>returns a list so whatever occurs within the parentheses will already
>have occurred by the time the loop starts.  So yes the sort has already
>been done before the first iteration of the loop is executed.

This answer like several others in this thread misses the point.

The question was not "How are (most) parenthesized expressions (lists, in
particular) evaluated?" but , rather, "*When* are induction variables
evaluated?" Programming languages differ on this point and those lacking a
formal definition of their semantics (e.g. Perl) are often unclear about
what approach they take. Some would do a full evaluation during the loop
preamble (and within the body of the loop disallow modifications [other
than those implied by the loop syntax] to the variables). At the other
extreme are languages which evaluate *all* the variables on *each*
iteration and are, generally, quite permissive about modifications to
them. For languages with informal definitions, it is left up to the
discretion (whim?) of the compiler/interpreter implementor(s) and may vary
according the sophistication (e.g. code hoisting, interprocedural dataflow
analysis, etc.) of the code optimization/generation.

One could, indeed, perform a simple test to resolve the question in the
cited *example* but many compilers (and, I assume, "semi-compilers", as
well) do "special case" analysis as part of their optimizations so that ad
hoc testing may not provide a conclusive answer to the general question.
This is, of course, one of the often advanced arguments in favor of having
*formal* definitions for languages.

One area in Perl's docs (at least, one that comes readily to mind) that
refers *explicitly* to the question of *when* expressions are evaluated
involves the "o" operator in pattern processing. If it is needed to insure
that the expression wil not be (redundantly) reevaluated, it is not
unreasonable to infer (or, perhaps, feel uncertain) that expressions may
be reevaluated in other contexts.

>Bear in mind that I have already read the rest of this thread and would
>suggest that every suggestion that has been made is perfectly valid.

>When you say:

>>But don't give me a hard time b/c I didn't like your response.

>You are lapsing into a state of mind that will win you few favours. These
>people know of what they speak.

While the people who provide most of the answers are most certainly quite
knowledgeable about Perl, some of them do seem overly prone to fire off
RTFM-type replies after a careless reading of a question in the belief
that the question is elementary and betrays a lack of research on the part
of the poster when, in fact, closer examination of the question would
reveal that it addresses legitimate points of uncertainty. Mayhap, they
have been lulled into a state of semi-somnolence by the, admittedly,
frequent "dumb" questions. Then, again, expertise in Perl does not
*necessarily* preclude ineptitude in reading/understanding questions
*about* Perl. Finally, it may be (as some have suggested) that there are
"answer 'bots'" predicated on the (statistically sound) assumption that if
80% (or so) of the questions are dumb, then any given (randomly selected)
question is probably dumb and can be replied to by a simple RTFM.

>From what I've seen, the only questions *guaranteed* to receive careful
reading and studied replies are those that propose some regex and ask if
it cannot be made a few bytes shorter.

--
-----------------------------------------------------------
samdie@wsfd.org 199806070240 -0400



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

Date: Sun, 07 Jun 1998 19:44:47 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Foreach Efficiency
Message-Id: <357ae859.33626403@news.btinternet.com>

On Sun, 07 Jun 1998 14:40:06 -0400, samdie@wsfd.org wrote :

<big snip>

>
>From what I've seen, the only questions *guaranteed* to receive careful
>reading and studied replies are those that propose some regex and ask if
>it cannot be made a few bytes shorter.
>

Rubbish.  This question has received  far more coverage than it need
have. When:

On Thu, 04 Jun 1998 21:07:47 GMT, John Porter wrote :

>Peter A Fein wrote:
>> 
>> foreach my $i (sort article_cmp @all_pages) {
>> 
>> My inclination is that the list-generating sort only gets done once,
>> and therfore doing it outside the loop and storing it in a variable
>> which foreach then indexes would be unnecessary.  Is this correct?
>
>That's a good inclination to have.
>Why don't you test your hypothesis using Benchmark?
>

That was basically enough of it.  Peter was correct in his assumption
that the list was sorted once.  John pointed him toward a way of
determining whether he was correct.  But unfortunately Peter got out
of his pram:

On Thu, 4 Jun 1998 21:50:14 GMT, Peter A Fein wrote :
>
>Well, because I have finals in a few days and I need to get this
>working yesterday.  Although I'd like to mess around & benchmark parts
>of my code at some point, that point is not now.  Anyway, a trip to
>the perldoc pages for something else had sample code in this style, so
>I'll assume the documentation is correct.
>

And then so on and so forth.

Your initial assertion is obviously incorrect - if it was correct then
this newsgroup would cease to function. Although of course some would
suggest that this newsgroup has already ceased to function.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 07 Jun 1998 11:46:53 -0700
From: Rick Noble <info@thewebmasters.bc.ca>
Subject: Help with Posting Method
Message-Id: <357AE01B.ACBEB268@thewebmasters.bc.ca>

hello

Please let me state up front that I am not a true PERL programmer by any
stretch of the imagination, but I have managed to turn out a few that
have worked.

Now my problem

I am writing a PERl script to post form information to a number of
search engines. I have gotten to the point now that I can process the
form correctly, validate the url, assign the form elements to some
variables needed, and loop through a text file grabing the engines we
are going to post to.

When all is said and done I use a print statement to display the
completed string that is ready for the submission, just to be sure that
I have done everything correctly.
I can now copy and past this string into the "Location/Address" field in
Netscape and the submission
is accepted.

Next, to actually POST from the perl script, I have tried various
modules: HTTP::Request::Common; ,LWP::UserAgent; and have read the
documentation on these modules. I have also read the LWP Cookbook and
tried some of the examples, but I'm afraid I just don't get it.

When ever I use any of the methods described in the above modules,
Netscape generates a
"Document Contains No Data" alert window.

Can't it just be as easy as:

$ua = LWP::UserAgent->new;
$ua->request(POST '$URL'; #URL being the variable that contains my
posting string

Any and all help is truly appreciated
thank you

Rick Noble


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

Date: Sun, 07 Jun 1998 19:04:05 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Help with Posting Method
Message-Id: <6leoa4$931$1@strato.ultra.net>

[ posted and mailed ]

Rick Noble <info@thewebmasters.bc.ca> wrote:
-> hello
-> 
-> Please let me state up front that I am not a true PERL programmer by any
-> stretch of the imagination, but I have managed to turn out a few that
-> have worked.

I hate to label people but if you have written a program, you are 
unfortunately a programmer.

-> Next, to actually POST from the perl script, I have tried various
-> modules: HTTP::Request::Common; ,LWP::UserAgent; and have read the
-> documentation on these modules. I have also read the LWP Cookbook and
-> tried some of the examples, but I'm afraid I just don't get it.

The example in the cookbook couldn't be any clearer. which part don't you 
understand?

-> When ever I use any of the methods described in the above modules,
-> Netscape generates a
-> "Document Contains No Data" alert window.
 
That error means that you aren't sending anything to STDOUT. Your program may 
actually be doing as you'd like but you aren't printing the results.

-> Can't it just be as easy as:
-> 
-> $ua = LWP::UserAgent->new;
-> $ua->request(POST '$URL'; #URL being the variable that contains my
-> posting string

It is almost that simple. try the examples in the cookbook from the command 
line until you get it working. Then and only try encorporating it into your 
cgi.


HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: Sun, 07 Jun 1998 17:17:44 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: I'm having problems:
Message-Id: <8cvhqdxhaq.fsf@gadget.cscaper.com>

>>>>> "mana" == mana  <mana@technologist.com> writes:

mana> Use this logic for recursing into sub directories

 ... 

mana> 			if ($file ne '.' && $file ne '..') 
mana> 			{
mana> 				if (-d "$dir/$file" && $file ne '') 
mana> 				{
mana> 					# push into the stack if it is a directory
mana>  					push (@dir_list, "$dir/$file");  


No.  Please don't.  Please stop reinventing File::Find.  This code is
broken, as it will follow symlinks incorrectly, off into gaga land,
even back to where you've been before, and that'll be an infinite
loop.  Not only that, but a lot of what you're doing is pretty
inefficient.

Please stop reinventing File::Find.

Please stop reinventing File::Find.

Is that clear now?

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 85 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 7 Jun 1998 16:51:20 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is PERL case sensitive?
Message-Id: <6lege8$2ve$1@marina.cinenet.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: ac-ro-nym n.  A word formed from the initial letters of a name, such as 
: WAC for Women's Army Corps, or by combining initial letters or parts of a 
: series of words, such as *radar* for *ra*dio *d*etection *a*nd *r*anging.

I stand corrected; I thought it had to be initial letters only.

: Having rejected C and C++ from my list of examples, I'm now sorry I also 
: rejected Pascal.  We could have had some fun creating a phrase for that 
: to be an acronym of.  I've seen such a formation called a 'retronym' but 
: that neologism also has other definitions.

"Planning A System?  Consider Another Language." :)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sun, 7 Jun 1998 09:50:34 -0700
From: "Timothy Lowe" <timlowe@u.washington.edu>
Subject: Re: newbie ques:  Here Documents
Message-Id: <6legbv$8g4$1@texas.nwlink.com>

Thanks a ton.. It was the leading white space.  I was under the impression
that the whitepsace didn't really matter.  I'm also on my way to get the
"camel" book.  Apparently that is the defacto standard manual.  Thanks
again.


Tim Lowe
timlowe@u.washington.edu




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

Date: 7 Jun 1998 17:02:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: newbie question on pattern matching
Message-Id: <6leh2b$2ve$2@marina.cinenet.net>

Bob Trieger (sowmaster@juicepigs.com) wrote:
: xuming@email.unc.edu (Xuming Wang) wrote:
: -> wings <xuchu@iscs.nus.edu.sg> wrote:
: -> >          open (FP1,"test") || die "cannot open file\n";
: -> 
: -> when you write die message for file operation, better include $! which
: -> contents the error message in plain english.  and don't put "\n" at the
: -> end.
: 
: Why not put the newline character in die message? If you don't you end up with 
: the prompt at the end of the error instead of on a new line.

Nope.  From 'perldoc -f die':

  If the value of EXPR does not end in a newline, the current script line
  number and input line number (if any) are also printed, and a newline  
  is supplied.

This info can make debugging much easier.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 7 Jun 1998 17:46:26 GMT
From: "wolfram.oehms" <wolfram.oehms@metronet.de>
Subject: perl-frage
Message-Id: <01bd923c$143a4ca0$97a5a8c1@default>

Wer kann mir helfen?

Ich mvchte den Nutzern eines bestimmten HTML-Formulares, welches Daten an
ein Perl-Script sendet die Ergebnisse einerseits am Bildschirm ausgeben,
parallel dazu aber auch per Auto-Email an ihre Email-Adresse schicken.
Ich bin auch schon soweit, die Ergebnisse per Automail an mich selbst zu
schicken, ich wei_ aber nicht, wie man die Email-Adresse des Benutzers
bekommt, ohne da_ er sie eingeben mu_.

Gibt es eine Mvglichkeit, die Mail-Adresse eines Besuchers zu verwenden,
ohne da_ sie von ihm eingegeben werden mu_?

Vielen Dank f|r Antwort und M|he


Oehms



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

Date: Sun, 7 Jun 1998 11:16:06 +0500
From: "tower" <tower_removethis@seanet.com>
Subject: problem with LWP
Message-Id: <6lelgh$7jb@q.seanet.com>

Thanks very much for all the help.  I'm at the stage now from copying some
code in previous posts where I run the below and get further, but still no
cigar.  The error message the below gives me is:

D:\Projects\Tiger>perl proxyhelp3.pl
Error: 501 Protocol scheme '' is not supported
--- HTTP::Response=HASH(0x88cf18) ---
RC: 501 (Not Implemented)
Message: Protocol scheme '' is not supported


Ideas anyone?

Thanks,
Sylvia


#! /bin/perl

# Start the agent stuff
use LWP::UserAgent;
$ua = new LWP::UserAgent;

# Set up the proxy
$ua->proxy('http' => 'http://192.168.1.1:8080/');

# Create the request
my $req = new HTTP::Request 'GET' => 'www.yahoo.com';
$req->header('Accept' => 'text/html');

# Send request
$res = $ua->request($req);

# Check the outcome print url if successful or error message if not.
if ($res->is_success) {
print $res->content;
} else {
print "Error: " . $res->code . " " . $res->message;
}

print $ua->request($req)->as_string;





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

Date: Sun, 07 Jun 1998 19:13:30 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Q: drop a 'slice' in list
Message-Id: <357ae27b.32124369@news.btinternet.com>

On 06 Jun 1998 04:29:56 -0700, Xah Lee wrote :

>
>How can I delete a sequence of elements of a **LIST** in one line? (one semicolone)
>To illustrate, the following drop the last 3 elements using two lines.
>
>my @aa = split(m( ),'Dvorak keyboard is wonderful. Eh eh eh?');
>my @result = @aa[0 .. $#aa-3];
>

Just to tide you over until the oneliners get back on line:

#!perl
 @result =  ( split(m( ),'Dvorak keyboard is wonderful. Eh eh eh?'))[0
 ... 3];
print @result;

But of course you need to know the number of elements in advance.
There is something in there I figure but I got bored ...

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 7 Jun 1998 19:23:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Q: puzzled: regex with inperpolation
Message-Id: <6lepbn$cvb$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ronald J Kimball
<rjk@coos.dartmouth.edu>],
who wrote in article <1da95cq.1uwb4cs1rvdo3wN@bay1-212.quincy.ziplink.net>:

> First, when you assign to $patternString, you are using the single-quote
> operator, q//, which does not recognize \Q, \E, etc.  In such cases, the
> single-quote operator leaves the character sequence untouched.  So the
> value of $patternString is '(\\Q.m\\E|\\Q.nb\\E)$'.
> (Note that '\\Q' is equivalent to '\Q'.)
> 
> Second, when you interpolate $patternString in m//, there is only one
> level of interpolation.  So, the pattern that is passed to the regex
> engine is '(\Q.m\E|\Q.nb\E)$'.
> 
> Third, the regex engine does not recognize \Q, \E, etc.  In such cases,
> the regex engine matches the literal character.  So, the pattern that
> the regex engine tries to match is '(Q.mE|Q.nbE)$'.
> 
> To solve this problem, use the double quote operator, qq//, when
> assigning to $patternString.
> 
> $patternString = qq{(\Q.m\E|\Q.nb\E)\$};
> 
> Note that the final $ must now be preceded by a backslash.

This is one of demonstrations why a new quoting operator qr// is
needed.  Neither q// nor qq// interpolate in the in the same way as
m// and s//.

Ilya


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

Date: 7 Jun 1998 14:57:12 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Q: sorting table %book by $title
Message-Id: <357ae288.0@news.one.net>

dow.jones@home.se wrote:
> Hallo.

> I have a structure that looks like this

> %book = {$isbn -> [$author, $title]}

> I want to print out everything in %book like this

> while (($isbn, $reference) = each %book)
> {
> print STDOUT >>HTML;
> <TR>
> <TD>$isbn</TD>
> <TD>$reference->[0]</TD>
> <TD>$reference->[1]</TD>
> </TR>
> HTML
> }

> The question is, how do I sort %book by $title.

http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq4/How_do_I_sort_a_hash_optionaly.html

http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html

http://search.yahoo.com/bin/search?p=perl+sort

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Fast, reliable, cheap.              131 Willow Lane, Floor 2  | ||  _ \
Pick two and we'll talk.            Oxford, OH  45056         | || |_) |
 -- unknown                         <mikeh@minivend.com>     |___|  _ <
                                    513.523.7621 FAX 7501        |_| \_\


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

Date: 7 Jun 1998 17:49:47 GMT
From: "wolfram.oehms" <wolfram.oehms@metronet.de>
Subject: question
Message-Id: <01bd923c$8c1dd3e0$97a5a8c1@default>

Is there a way to send an email out to everyone who comes to our website
automatically without them filling out a form,etc... ?

Thanks
Wolfram


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

Date: 7 Jun 1998 18:00:20 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: question
Message-Id: <6lekfk$2ve$3@marina.cinenet.net>

wolfram.oehms (wolfram.oehms@metronet.de) wrote:
: Is there a way to send an email out to everyone who comes to our website
: automatically without them filling out a form,etc... ?

No.  Most browsers don't send out the email addresses of their users
(thank god).  You have to ask the user for his/her email address, and send
them mail if they willingly give it to you.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sun, 07 Jun 1998 18:35:11 GMT
From: paulb@user2.teleport.com (Paul Buder)
Subject: Re: regexp to delete trailing spaces?
Message-Id: <6lemgs$aen$1@user2.teleport.com>

In <6kfdur$1nr$1@gte1.gte.net> "Kirk D. Haines" <khaines@oshconsulting.com> writes:

 >$a = "All that glitters               ";
 >print "|$a|\n";
 >$a =~ s/\s*$//;
 >print "|$a|\n";

 >When run:

 >|All That Glitters     |
 >|All That Glitters|

>Note that this deletes all trailing whitespace. 

And for an added bonus it capitalizes too!



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

Date: 7 Jun 1998 16:46:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Removing a character from a string
Message-Id: <6leg4v$9vg$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Ala Qumsieh <aqumsieh@matrox.com> writes:
:> this will substitute "" for  the first "&" from anywhere in that
:> string:
:> $string =~ s/&//;
:>
:>   --  Ed Weinberg,
:
:You might want to use the /g modifier there.
:But, a faster solution would be :
:
:$string =~ tr/&//;

No, that's not what that does.  Why are you changing & to &?
You forgot /d.

--tom
-- 
    X-Windows: Complex nonsolutions to simple nonproblems.
	--Jamie Zawinski


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

Date: Sun, 07 Jun 1998 17:32:06 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Use of HTML, POD, etc in Usenet (was: Re: map in void context regarded as evil - suggestion)
Message-Id: <1da65ob.1wfni5h12lbq9uN@roxboro0-044.dyn.interpath.net>

Sam Trenholme <set@netcom.com> wrote:

> You know, I had this particular flame war on comp.os.linux.misc some
> months ago, and I concluded the only way a Usenet will expand in to a
> decent markup language is if there is a way to embed basic HTML in the
> header of the message, with a simple one or two-line script that would say
> things like "Start boldface at the 124th character in the posting", and so
> on. 
> 
> It would be akin to an X-Face header, maybe a X-Markup header or some such.
> 
> Nice idea.  It would make a wonderful <EM>perl</EM> script if someone
> wanted to actually implement it.

It's already been done - kinda, Brad Templeton has designed and written
it up, but AFAIK nobody has actually implemented it in a newsreader.


See: <http://www.templetons.com/tech/oob.html>

-- 
John Moreno


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

Date: Sun, 07 Jun 1998 18:53:49 GMT
From: bobbybooby@my-dejanews.com
Subject: Re: User System Info.
Message-Id: <6lenjs$o6r$1@nnrp1.dejanews.com>

Exactly!!!

Great!	This is exactly what I needed!	I wanted to be able to get the UA
information using perl, which is why I posted this to this group, so this
wasn't necessarily an incorrect posting - guess I misworded my intorductory
sentence.  Probably should have said, "I've seen this done, can it be done in
Perl.  Sorry to all I've offened!  Thanks!

In article <MPG.fde0019f56aebc898968c@hplntx.hpl.hp.com>,
  lr@hpl.hp.com (Larry Rosler) wrote:
>
> In article <6l052o$eb3$1@nnrp1.dejanews.com>, bobbybooby@my-dejanews.com
> says...
> > I'm sure that I have the totally wrong group, but I'll go for it anyway.
>
> You do, but as a simple Perl script will help you, here goes...
>
> > I've seen a couple of postings related to using JavaScript and Java to obtain
> > Screen Size information from the user's system.  However, none of these is
> > working with what I want.
> >
> > If you check out www.anonymizer.com and click on the "What we know about you"
> > link.  You'll see information presented that typically isn't anything new.
> > However, the screen size baffled me as well as the processor.
> >
> > They are NOT using JavaScript.	It seems to be something with a SSI or CSI.
>
> It is simply CGI.
>
> ...
> > Any help out there, this has been killing me today trying to come up with a
> > script that works.  I'm being adamant because I'm using IE3.02 (client uses
> > this) and none of the Java/JavaScript examples work.  The one on anonymizer
> > is the only one that does!
> ...
>
> That's your answer.  The IE browsers send back a load of gratuitous
> information about the client, including screen size, color depth,
> processor type and operating system.  Try the following trivial script,
> both from IE and Navigator (or whatever):
>
> #!/usr/local/bin/perl -w
>
> print "Content-Type: text/plain\n\n",
>     map "$_\t= $ENV{$_}\n", sort keys %ENV;
>
> --
> Larry Rosler
> Hewlett-Packard Laboratories
> lr@hpl.hp.com
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

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

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