[8708] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2325 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 15 03:07:23 1998

Date: Wed, 15 Apr 98 00:00:50 -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           Wed, 15 Apr 1998     Volume: 8 Number: 2325

Today's topics:
    Re: correct useage of the if statement <rootbeer@teleport.com>
        Delocalizing $1, $2, etc... <fecund@fatnet.net>
    Re: Delocalizing $1, $2, etc... <rootbeer@teleport.com>
        Delocalizing $1, $2, etc. <fecund@fatnet.net>
    Re: Easy way to count lines in a file dennis_marti@yahoo.com
    Re: File download problem in IE4.0 <rootbeer@teleport.com>
    Re: going to a specific line number in a file (Tom Mornini)
    Re: greed (David Oswald)
    Re: How could I improve my perl script's speed ? <dorr@cetrel.lu>
    Re: Ideas for installations (Martien Verbruggen)
    Re: info on cookies (Abigail)
    Re: IO::Handle error. <rootbeer@teleport.com>
    Re: Learning Perl <rootbeer@teleport.com>
    Re: metasearch cgi script <rootbeer@teleport.com>
    Re: Numeric validation <rootbeer@teleport.com>
        Perl ne CGI (was: Re: Ideas for installations) <rootbeer@teleport.com>
    Re: Perl, HP-UX, and memory ... (Abigail)
    Re: perl5.004 compiling problem (two makefile's????) <rootbeer@teleport.com>
    Re: Problem with Website 2.0 CGI <rootbeer@teleport.com>
    Re: Question? <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
    Re: Question? (Abigail)
        recursive fuctions (Byron Jones)
        RegEx for matching multiple lines of text <brackett@pobox.com>
    Re: RegEx for matching multiple lines of text <rootbeer@teleport.com>
    Re: Weird Truncate Behavior <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 15 Apr 1998 06:12:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve <syarbrou@ais.net>
Subject: Re: correct useage of the if statement
Message-Id: <Pine.GSO.3.96.980414231038.1896A-100000@user2.teleport.com>

On Wed, 15 Apr 1998, Steve wrote:

> I have an if statement as follows:
> 
> elsif ($entry[22] == 6)

Looks like just part of an if, but okay...

> the value $entry[22] can be set to anything that starts with a 6 and
> it accepts it as a valid entry.  I've tried the single quote and the
> double one and nothing seems to prevent if from saying it's valid.
> The value entered for entry[22] is 6NA and it things it's valid.  How
> should I correctly set this up? 

First, define just what should and what should not match. Second, write
the if-test to check for that. For example, you may want this.

    if ($entry[22] eq '6') { ... }

Then again, maybe you want something else, but I can't tell what that
would be from your prose. :-)

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 14 Apr 1998 21:58:58 -0700
From: "yary h." <fecund@fatnet.net>
Subject: Delocalizing $1, $2, etc...
Message-Id: <35343E92.6E50@fatnet.net>

This is a multi-part message in MIME format.

--------------1D176819E25
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

(this is a repost, as the original post had broken enclosures)

OK, I have this method.  You give it a string, which it treats as a
regexp.  It then fires off a command to a server, and matches the reply
against the string.

I think it would be cool if the caller could then use $1, $2 etc.
But they're always local to the current block.  Is there a way to
un-localize them, or to execute the pattern-match in the caller's
context?

sample files attached so y'all can see what it is::
-yary

--------------1D176819E25
Content-Type: text/plain; charset=us-ascii; name="MyClass.pm"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="MyClass.pm"

#!perl -w
use strict;
package MyClass;

my @data = qw(Anna Beula Charlotte Dorothy Erin Francis Gertrude);

sub new { bless \my $heart; }

sub test {
    my $exp = $_[1];

    grep /$exp/, @data;
}

--------------1D176819E25
Content-Type: text/plain; charset=us-ascii; name="test.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="test.pl"

#!perl -w
use strict;
use MyClass;

my $ladies = new MyClass;

my @u = test $ladies 'u(.+)';

# I want this to say:
# Ladies with u are Beula and Gertude, the last ends with 'de'.
print "Ladies with u are ",join(" and ",@u),
    ", the last ends with '$1'.\n";



--------------1D176819E25--



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

Date: Wed, 15 Apr 1998 06:27:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "yary h." <fecund@fatnet.net>
Subject: Re: Delocalizing $1, $2, etc...
Message-Id: <Pine.GSO.3.96.980414232501.1896D-100000@user2.teleport.com>

On Tue, 14 Apr 1998, yary h. wrote:

> I think it would be cool if the caller could then use $1, $2 etc.
> But they're always local to the current block.  Is there a way to
> un-localize them, or to execute the pattern-match in the caller's
> context?

Perl version 17 may have this capability, but I don't think there's a way
to do exactly that in current versions of Perl. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Apr 1998 21:14:17 -0700
From: Yary H.  <fecund@fatnet.net>
Subject: Delocalizing $1, $2, etc.
Message-Id: <6h1c6p$g8a@co-op.newsguy.com>

OK, I have this method.  You give it a string, which it treats as a
regexp.  It then fires off a command to a server, and matches it
against the string.

I think it would be cool if the caller could then use $1, $2 etc.
But they're always local to the current block.  Is there a way to
un-localize them, or to execute the pattern-match in the caller's
context?

sample files attached so y'all can see what it is::
-yary

--------------2A3B69673B46
Content-Type: text/plain; charset=us-ascii; name="MyClass.pm"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="MyClass.pm"

#!perl -w
use strict;
package MyClass;

my @data = qw(Anna Beula Charlotte Dorothy Erin Francis Gertrude);

sub new { bless \my $heart; }

sub test {
    my $exp = $_[1];

    grep /$exp/, @data;
}

--------------2A3B69673B46
Content-Type: text/plain; charset=us-ascii; name="test.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="test.pl"

#!perl -w
use strict;
use MyClass;

my $ladies = new MyClass;

my @u = test $ladies 'u(.+)';

# I want this to say:
# Ladies with u are Beula and Gertude, the last ends with 'de'.
print "Ladies with u are ",join(" and ",@u),
    ", the last ends with '$1'.\n";



--------------2A3B69673B46--


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

Date: Wed, 15 Apr 1998 00:33:12 -0600
From: dennis_marti@yahoo.com
Subject: Re: Easy way to count lines in a file
Message-Id: <6h1gqp$hl9$1@nnrp1.dejanews.com>

In article <OlBY.155$GO6.554867@news3.atl.bellsouth.net>,
  "Harold Reed" <hareed@bellsouth.net> wrote:
>
> Is there an easy way to count the number of lines a file has? I am working
> with several access log files that are routinely larger than 300MB and I
> have developed a crude update that lets the user know every 1000 lines that
> are processed by the script - so you can get an idea of where the script is
> in it duties (a stdout update, if you will). Is there a way that you can get
> a readout of the number of lines in a file quickly?

Do you really need a line count? If you showed status with a "percent
complete" instead of a "line of lines" you could calculate the percentage and
display it as you read the file in. Something like this:

$size = -s $file;
$seen = 0;
open F, $file or die $!;
while (<F>) {
    $red += length;
    $percent = int(($red / $size) * 100);
    unless ($percent % 10 or $percent == $seen) {
        print "$percent% complete\n";
        $seen = $percent;
    }
    # the rest of your stuff
}

Not that that's not CPU intensive, but it beats doing a `wc` (an easy way to
count lines) and then reading the file again.

Dennis Marti

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


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

Date: Wed, 15 Apr 1998 05:22:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: bidyut@yahoo.com
Subject: Re: File download problem in IE4.0
Message-Id: <Pine.GSO.3.96.980414222224.6195U-100000@user2.teleport.com>

On Tue, 14 Apr 1998 bidyut@yahoo.com wrote:

> One more point i have found out after doing a lot of work on that. If I
> hardcode the filename is CGI script, then IE is able to download and show the
> file in browser. But if i try to get the filename dynamically(i.e passing
> through post method from a form and obtaining it by using
> $query->param('filename')), then IE fails in showing up the file.

If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 05:56:06 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Re: going to a specific line number in a file
Message-Id: <tmorniniErFxtI.BtD@netcom.com>

Pratima Easwar (pratima@synopsys.com) wrote:
: I have two files. File #1 has line numbers (not necessarily
: consecutive) for lines in file #2. I need to create an output
: file in the following format.
: Line #1 from File #1 ----- Line #x from File #2 (I got the #x from File 1)

: The problem I am having is I dont know how to go to say line 25 in File 2
: directly - if there is a way. I could reset to the beginning of the file
: and keep reading in lines until I get to line 25, but I feel there must be
: a more efficient way.

A little hard on RAM, but it works.

#!/usr/bin/perl -w

use strict;

open(FILE2,'bible11.txt') || die "Belch! - can't open file 2";
my @file2=<FILE2>;
close FILE2;

open(FILE1,"lines.txt") || die "Belch! - can't open file 1";
while (<FILE1>)
 {
  chomp;
  print $_,'-'x5,$file2[$_-1],"\n";
 }
close FILE1;

-- Tom Mornini
-- InfoMania


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

Date: Wed, 15 Apr 1998 05:37:48 GMT
From: doswald@xmission.com (David Oswald)
Subject: Re: greed
Message-Id: <35344721.11545182@news.xmission.com>

On Wed, 15 Apr 1998 00:41:43 -0400, Ronald J Kimball
<rjk@coos.dartmouth.edu> wrote:

>Scott Stark wrote:
>> 
>> BTW, I've looked through both of the Schwartz books and found them so poorly
>> indexed I couldn't find anything useful about greediness.
>
>Look up 'greedy matching' in the Camel book, 2nd ed.  Flip to the first
>reference, and then turn the page.

Or, get the best source of all for information on Regexes; Friedl's
book, Mastering Regular Expressions (Published by O'Reilly & Assoc,
Inc. as the Cute Owls book).

You'll never find a more fantastic discussion on greediness, lazy
quantifiers, NFA, regex engines, Perl's implementation of regexes,
etc.

Dave


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

Date: Tue, 14 Apr 1998 17:18:54 +0200
From: Denis DORR <dorr@cetrel.lu>
Subject: Re: How could I improve my perl script's speed ?
Message-Id: <35337E5E.E6E68688@cetrel.lu>

Denis DORR wrote:
> 
> Hi,

> [ some oddities here ]

> and still doesn't see The Light ...)

Ouuups : read "don't see" here (sorry, my English is not better than my
Perl).

--

dorr@cetrel.lu


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

Date: 15 Apr 1998 05:31:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Ideas for installations
Message-Id: <6h1go9$kgp$1@comdyn.comdyn.com.au>

In article <3533CA67.E1E42446@coincnx.com>,
	Mark Bunkowske <mbunks@coincnx.com> writes:

> I thought that a CGI/Perl group (Perl IS a CGI language) would be
                                   ^^^^^^^^^^^^^^^^^^^^^^
That statement is pertinently wrong. There is no such thing as a CGI
language. CGI is a  standard for external programs to interface with
information servers. It is not a language. There is no such thing as a
CGI language. CGI can be implemented in virtually any programming
language.

Check out the following links to read about what CGI is:

http://hoohoo.ncsa.uiuc.edu/cgi/overview.html
http://hoohoo.ncsa.uiuc.edu/cgi/interface.html

It is true that CGI applications are often written in Perl, but they
are also often written in C. Try and make the statement 'C is a CGI
language' on comp.lang.c, and see what happens then. Other 'languages'
than the abovementioned that I used to write CGI applications are tcl,
python, ksh, csh, C++. I could even do it in fortran if that would
make you happy. The fact that I, and maybe thousands of others used
any of those languages for a CGI application doesn't make any of those
languages CGI languages.

Nowadays I don't ever use perl for CGI applications. I program in Perl
on a daily basis. Not once for CGI. You can make perl create a typeset
PostScript document from some odd format that you invent yourself.
Does that make Perl a typesetting language? You can make perl add 1
and 1. Does that make it a calculator?

Sorry for the rant. Just annoyance overflow.
Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


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

Date: 15 Apr 1998 06:36:18 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: info on cookies
Message-Id: <6h1kh2$av6$1@client3.news.psi.net>

Lloyd Zusman (ljz@asfast.com) wrote on MDCLXXXVIII September MCMXCIII in
<URL: news:ltpvijlmrh.fsf@asfast.com>:
++ abigail@fnx.com (Abigail) writes:
++ 
++ > Lloyd Zusman (ljz@asfast.com) wrote on MDCLXXXVIII September MCMXCIII in
++ > <URL: news:ltu37vlu2m.fsf@asfast.com>:
++ > ++ abigail@fnx.com (Abigail) writes:
++ > ++ 
++ > ++ > Gilles Chong (glchy@csah.com) wrote on MDCLXXXVII September MCMXCIII in
++ > ++ > <URL: news:35332C56.7433130D@csah.com>:
++ > ++ > ++ Hi,
++ > ++ > ++ im playing with cookies for the moment. Generating them with a
++ > ++ > ++ javascript is very simple. But im stuck when it comes to getting the
++ > ++ > ++ cookie and reading it in Perl. It seems that there is NOT an env
++ > ++ > ++ variable which corresponds to the cookie.             ^^^^^^^^^^
                                                                   ||||||||||
                                                                   ||||||||||
                                                                   ||||||||||
                                                                   ||||||||||
                                                                   ||||||||||
                                                                   ||||||||||
                                                                   ||||||||||

++ > ++ > Then that's a problem you have to take up with your server, not with Perl.
++ > ++ 
++ > ++ ... although this question is also relevant to Perl, since there's a
++ > ++ Perl module called "CGI" which provides a method to access cookies.
++ > ++ Furthermore, this method doesn't require you to directly access any
++ > ++ environment variables, so you don't need to be concerned about this
++ > ++ detail.
++ > 
++ > Really? Then how does the CGI module know which cookie is set?
++ > It calls the psychic hotline?
++ 
++ The Perl CGI module accesses the environment variable for you.  That's

How can it do that if there isn't one?

++ why I said (quoted above) that accessing cookies via the CGI module
++ doesn't require "you" to directly access any environment variables.
++ The word "you" referred to the original poster, not the CGI module
++ itself.
++ 
++ > Bottomline is, if there's no environment variable, not even the CGI
++ > module will help you. Take it up with your server.
++ 
++ Of course.  I never said there was no environment variable.

No, but Gilles Chong *did* say there wasn't one. And that was his
problem. Do us a favour and read what I'm replying to before you
reply to me, ok? 

++ By the way, if the original poster wants to access the enviroment
++ variable directly instead of using the `cookie()' convenience method
++ of the CGI module, this variable's name is "HTTP_COOKIE".
++ 
++ > In a server group.
++ 
++ ... or in the Perl CGI module man pages ... or in the Perl CGI::Cookie
++ module man pages ... or for some real detailed information about the
++ structure of cookies, one can go to the following URL, which is also
++ mentioned in the Perl CGI::Cookie man pages:

No, really. The claim is that there is no environment variable. Stop
trowing CGI.pm. Fix the problem. That's the server.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-


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

Date: Wed, 15 Apr 1998 05:25:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Pranav Parekh <pranav@recycler.com>
Subject: Re: IO::Handle error.
Message-Id: <Pine.GSO.3.96.980414222335.6195V-100000@user2.teleport.com>

On 14 Apr 1998, Pranav Parekh wrote:

> Can't locate object method "autoflush" via package "IO::Handle" at
> /theperlfile.pl line 186.
> 
> I looked at line 186 and the code on that line is: SOCKET->autoflush();

Sounds as if that module (or a related one) is mis-installed on your
system. My guess (and it's just a guess) is that you've somehow got an old
version of IO::Handle instead of a new one. Re-installing Perl should fix
things, although there may be a simpler way. :-)

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 05:21:51 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Baker <dtbaker_@flash.net>
Subject: Re: Learning Perl
Message-Id: <Pine.GSO.3.96.980414222113.6195T-100000@user2.teleport.com>

On Tue, 14 Apr 1998, Dan Baker wrote:

> I'm just learning too, and have just finished "Perl5 for Dummies". It
> was fast and easy reading that covered the basics pretty well.

That's not what I hear about that book. But maybe it's a good book if you
are a dummy. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 06:22:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Brycejamz <brycejamz@aol.com>
Subject: Re: metasearch cgi script
Message-Id: <Pine.GSO.3.96.980414231543.1896C-100000@user2.teleport.com>

On 15 Apr 1998, Brycejamz wrote:

> does anybody know where I can find a script to search many search
> engines at once? 

(This reply may be curt, but it's not intended to be rude.) Your question
is not a Perl question. Yes, somebody does know where you can find such a
script. For example, there's one running on many of the sites you'll find
if you search for "searching the web" on Yahoo. If you're looking to find
free software, there are better ways to do that than posting to Usenet. 
Ask your local expert about using utilities like archie. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 05:16:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Fox <kfox@pt0204.pto.ford.com>
Subject: Re: Numeric validation
Message-Id: <Pine.GSO.3.96.980414221603.6195R-100000@user2.teleport.com>

On 14 Apr 1998, Ken Fox wrote:

> I'd prefer the FAQ say:
> 
>    if (/\D/)            { print "has nondigits\n" }
>    if (/^\d+$/)         { print "is a whole number\n" }
>    if (/^-?\d+$/)       { print "is an integer\n" }
>    if (/^[+-]?\d+$/)    { print "is a +/- integer\n" }
>    if (/^-?\d+\.?\d*$/) { print "is a real number\n" }

Have you submitted your suggestion to the address given in the FAQ for
this purpose? Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 06:00:23 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: mbunks@usa.net
Subject: Perl ne CGI (was: Re: Ideas for installations)
Message-Id: <Pine.GSO.3.96.980414223343.6195Y-100000@user2.teleport.com>

On Tue, 14 Apr 1998, Mark Bunkowske wrote:

> I thought that a CGI/Perl group (Perl IS a CGI language)

This is a common fallacy, but (if it's any comfort) you're not the first
or last to make this mistake. 

Let's consider an analogy. Imagine I post this message:

    Newsgroups: rec.aviation
    Subject: How to make poi

    Does anybody here have a good recipe for poi? I want to make
    some for a luau next week...

Now, everyone in that newsgroup laughs at my posting. Why is that, I
wonder. After all, nearly everyone who goes to Hawaii goes by airplane,
right? :-)

Of course, the situation is closely analogous here. Even though most
webstuff involves Perl, most of Perl has nothing to do with the web, in
the same way that most aviation has nothing to do with Hawaii. 

How can you tell whether yours is a CGI question, a Perl question, or
something else? Here are a few tips.

    1. If the answer would be essentially the same if the program were
    written in SNOBOL, Lisp, or Intercal, it's almost certainly not a Perl
    question. Another way of saying this is, if you could rephrase the 
    question not to mention Perl, you should do so - then it's virtually
    _sure_ to be a non-Perl question. 

    2. If the question can't possibly be asked without involving Perl
    directly, then it's probably a Perl question. In particular, if
    you know just what to do (say, read an environment variable) but
    you don't know how to do that in Perl, then that's a Perl question.
    (Although, in this case, one that's better answered via the docs
    than via the newsgroup.)

If you're still not sure, and you wish to avoid being flamed, here's a
neat trick. Look through this newsgroup until you find someone who seems
to be helpfully answering questions. (Shouldn't take too long... :-) Then,
contact that person by private email, saying, "You seem to be a helpful
person. If I were to ask the following question in c.l.p.misc, do you
think it would be on-topic, or is there a better place to find this
answer?" If you ask politely, you should always get a good response.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 15 Apr 1998 06:39:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl, HP-UX, and memory ...
Message-Id: <6h1knd$av6$2@client3.news.psi.net>

Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCLXXXVIII
September MCMXCIII in <URL: news:6h1dq8$jmr$1@mathserv.mps.ohio-state.edu>:
++ [A complimentary Cc of this posting was sent to 
++ <wvw@fred.net>],
++ > 

[ I missed the original posting ]

++ > Does anyone know how to REALLY get Perl to release memory to the kernel???

exec $0;


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Wed, 15 Apr 1998 05:30:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: jkit <jkit@jpmorgan.com>
Subject: Re: perl5.004 compiling problem (two makefile's????)
Message-Id: <Pine.GSO.3.96.980414222746.6195W-100000@user2.teleport.com>

On Tue, 14 Apr 1998, jkit wrote:

> During compiling I get the following messages.  Why?
> 
> make: Warning: Both 'makefile' and 'Makefile' exist

You can generally ignore that warning, especially if 'make test' succeeds. 
Building software often generates many warnings. Finding out which ones
are relevant is half of the fun! :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 05:18:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeremy Hermann <jhermann@ricochet.net>
Subject: Re: Problem with Website 2.0 CGI
Message-Id: <Pine.GSO.3.96.980414221715.6195S-100000@user2.teleport.com>

On Tue, 14 Apr 1998, Jeremy Hermann wrote:

> I can run perl scripts without problems from the default cgi-shl directory
> (C:\WebSite\cgi-shl).  I set up another Standard CGI mapping in the Server
> Properties dialog box, but when I try to run scripts from there, I get an
> error:
> 
> 500 Server Error
> The server encountered an error and was unable to complete your request.
> Message: CGI output from D:/My Documents/Medicineman/Earl/cgi-shl/test.cgi
> contained no blank line separating header and data (most likely a broken CGI
> program)

It's most likely a broken CGI program. :-)

> Any ideas?

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 14 Apr 1998 21:59:07 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Question?
Message-Id: <6h1eq7$qc5@bgtnsc02.worldnet.att.net>

Sam P. Kaipa wrote in message <35342F1F.6F1093AF@leland.stanford.edu>...
>How do I do a GetLine in perl?
>


Yes. That is a question.

Is this what you're looking for?

print "Type your response here: ";
$reply = <STDIN>;
chomp($reply);





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

Date: 15 Apr 1998 05:01:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Question?
Message-Id: <6h1ev0$8ok$1@client3.news.psi.net>

Sam P. Kaipa (skaipa@leland.stanford.edu) wrote on MDCLXXXVIII September
MCMXCIII in <URL: news:35342F1F.6F1093AF@leland.stanford.edu>:
++ How do I do a GetLine in perl?

You use diamonds.


RTFM.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: Wed, 15 Apr 1998 14:00:46 +0800
From: byronj@nd.edu.au (Byron Jones)
Subject: recursive fuctions
Message-Id: <byronj-1504981400460001@t-man.nd.edu.au>

greetings..

i want to write a perl script that renames files to 8.3, creating unique
names as needed.  the function needs to process subdirectories recusively.

i'm kinda new to perl, and i tried the code below.  it steps through the
first directory it finds recursivley but stops there.  it's like it's not
calling mydir recursively.

i looked in the perl faq on perl.com and in both my perl nutshell books
but to no avail.  the nutshell books state that you can call functions
recursivley and to be sure to delare variables as local (which is believe
i have).

so .. can anyone please help?

here's the code .. it's probably not-so-good code :(  help/tips?

--
#!/usr/bin/perl -w

use strict;

mydir (".");

sub mydir {
  my ($rootdir, $filename);
  $rootdir = $_[0];
  opendir (DIR, $rootdir);
  while ($filename = readdir (DIR)) {
    if (($filename ne ".") and ($filename ne "..")) {
      if (-d $rootdir . '/' . $filename) {
        mydir ($rootdir . '/' . $filename);
      } else {
        print "$rootdir/$filename\n";
      }
    }
  }
}
--

 | "More pressure than Rob Roy    :  Byron Jones                   |
||  with a new sword."            :  Communications Manager        ||
||  byronj@nd.edu.au              :  Notre Dame University         ||
 |  http://www.nd.edu.au/byronj/  :  Fremantle, Australia          |


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

Date: Tue, 14 Apr 1998 22:27:53 -0700
From: "Bracket Omensetter" <brackett@pobox.com>
Subject: RegEx for matching multiple lines of text
Message-Id: <6h1fa7$ojl$1@newsfeed.smartt.com>

Hi.

My apologies for not being to work this out on my own -- I'm new but
learning.

I've written a regular expression to extract some urls and associated
descriptive ascii from a longer page, but I can't seem to make it work when
the descriptions split over multiple lines.

For example:

<a href="apr7.htm">foo bar foo bar foo bar foo bar foo bar
    foo bar foo bar foo bar foo bar</a>

In this particular example the description it is split over two lines, but
it can be over more lines than this. It will always contain white space
after a split.

My current regex is as follows:

<a href=\"([^\"]+)\">([^\<]+)\s*<\/a>

This, however, picks up everything including the carriage return and new
line symbols (e.g., <<\n>> and <<\r>>).

I've tried multiple ways to slip in something for the \n and \r but it
hasn't worked. It's frustrating because I know this is easy but I'm
relatively new to this and can't seem to work it out. Any assistance much
appreciated.

B.




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

Date: Wed, 15 Apr 1998 06:30:19 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Bracket Omensetter <brackett@pobox.com>
Subject: Re: RegEx for matching multiple lines of text
Message-Id: <Pine.GSO.3.96.980414232737.1896E-100000@user2.teleport.com>

On Tue, 14 Apr 1998, Bracket Omensetter wrote:

> I've written a regular expression to extract some urls and associated
> descriptive ascii from a longer page, but I can't seem to make it work when
> the descriptions split over multiple lines.

Use HTML::Parse; don't try to write a regular expression to do that work.

[ one attempt snipped ]

> This, however, picks up everything including the carriage return and new
> line symbols (e.g., <<\n>> and <<\r>>).

Isn't that what you intended? You didn't want it to stop at the newline,
did you? (But maybe you just want to turn those characters into spaces.) 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Apr 1998 05:33:19 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Art Cohen <upsetter@shore.net>
Subject: Re: Weird Truncate Behavior
Message-Id: <Pine.GSO.3.96.980414223203.6195X-100000@user2.teleport.com>

On 14 Apr 1998, Art Cohen wrote:

> I've been trying to figure out why truncate was returning an error... I
> spent about a half an hour on it and finally, because I couldn't think
> of anything else to try, I changed the name of my filehandle literal
> from HANDLE to OUT. And it worked! 

Can you show us some code which shows this behavior? If you can make a
short (a dozen lines) example, please post it here. Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

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

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