[10243] in Perl-Users-Digest
Perl-Users Digest, Issue: 3836 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 27 12:07:14 1998
Date: Sun, 27 Sep 98 09:00:22 -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, 27 Sep 1998 Volume: 8 Number: 3836
Today's topics:
Re: <*> in cgi (David A. Black)
Re: cat reese > /dev/null (was Re: Perl & Java - differ <jdporter@min.net>
Re: cat reese > /dev/null (was Re: Perl & Java - differ <jdporter@min.net>
Double-Quotes in Procedure "System" <bench@surfshop.net.ph>
Re: downloading a file using perl... (Daniel Pray)
Re: How do i unpack a 64-bit long? (Larry Rosler)
Re: How to read contents of all *.TXT files in director <merlyn@stonehenge.com>
Re: How to read contents of all *.TXT files in director (David A. Black)
Re: How to read contents of all *.TXT files in director <merlyn@stonehenge.com>
Re: How to read contents of all *.TXT files in director (Gary L. Burnore)
Re: How to read contents of all *.TXT files in director (David A. Black)
Re: is perl better for these? <rick.delaney@shaw.wave.ca>
Re: Need help with $1 pattern (Allan M. Due)
Re: Need help with $1 pattern <gellyfish@btinternet.com>
Re: Need help with $1 pattern (David A. Black)
Re: Need help with $1 pattern (Tad McClellan)
Re: perl 5 on Freebsd - dbm Problems <eashton@bbnplanet.com>
Re: perl for apache <gellyfish@btinternet.com>
Re: POLL: Perl features springing into your face (Thomas A. Horsley)
Re: Returning a "near" hash key. (David A. Black)
threaded Perl 5.005 on HP-UX 10.20 anyone? <krueger@signal7.de>
using grep to snag patterns from another file <caustic@causticinteractive.nospam.com>
Re: using grep to snag patterns from another file (David A. Black)
Re: using grep to snag patterns from another file (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 27 Sep 1998 08:43:21 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: <*> in cgi
Message-Id: <6ulbt9$ao4$1@earth.superlink.net>
Hello -
"Rob W. Walls" <wallsr@jcave.com> writes:
>Hi,
> I am writing an app that requires a list of files in a particular
>directory on each run. I use:
> @FileList=<*.txt>;
> This works great from the command line, but will not work in a cgi
>program. Presumably, this is a 'feature' for security, but there must be
>some way to get a directory listing in a cgi environment?!?
>Does anyone have a solution?
If it is a feature, it isn't a Perl feature. Perl has no idea that you've
used it to write a CGI script. Either you're not in the directory you
think you are, or there are no *.txt files, or the server doesn't have
permission to read the directory.
David Black
dblack@saturn.superlink.net
------------------------------
Date: Sun, 27 Sep 1998 08:21:34 -0400
From: John Porter <jdporter@min.net>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360E2DCE.990BCE52@min.net>
George Reese wrote:
>
> In comp.lang.java.programmer Abigail <abigail@fnx.com> wrote:
> : Now, I happen to know that you started that code in 1992 -
> : simply because you started in that particular mud
> : after I did, and I started in the last days of 1991.
>
> : 1998 - 1992 == 6. Half a decade is a much closer approximation than
> : a decade.
>
> January 1991 to September 1998. Three months shy of 8 years.
Please help me, because I'm confused.
Late 1998 minus early 1992 is "just shy" of 7 years (not 8).
So, AFAICT, one of the following cases must be true:
A. You had some programming experience prior to early 1992,
that you haven't mentioned anywhere.
B. You're bad at arithmetic.
C. You are intentionally inflating the number, hoping
no one will notice.
--
John Porter
------------------------------
Date: Sun, 27 Sep 1998 08:22:41 -0400
From: John Porter <jdporter@min.net>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360E2E11.D3E4048E@min.net>
George Reese wrote:
>
> Do you want me to get it down for you to the exact second?
> Millisecond?
Why would we expect you to be any more honest about that
figure than you have been with any other?
--
John Porter
------------------------------
Date: Sun, 27 Sep 1998 23:22:40 +0800
From: "Benjamin" <bench@surfshop.net.ph>
Subject: Double-Quotes in Procedure "System"
Message-Id: <6ullos$kba$1@tempo.news.iphil.net>
How can I pass a quoted string i.e. "This is a subject" in the Perl
procedure 'system'. I'm trying to use this in passing a parameter
in-quotes to 'metasend' program (-s option).
A simple way of testing this is by making a script with the '/bin/echo
$subject', and assuming that variable $subject="This is a subject". The
script should display "This is a subject" (that is, with double-quotes)
instead of just This is a subject, with no double-quotes.
------------------------------
Date: Sun, 27 Sep 1998 12:04:58 GMT
From: daniel@intecomp.com (Daniel Pray)
Subject: Re: downloading a file using perl...
Message-Id: <daniel-2709980505430001@usr24-dialup60.mix1.sacramento.cw.net>
Is there a way in the OPEN command to do something else if the file
download times out or the user stops downloading? For example.
my $name = "filexxxxx";
open(FILE, $name);
print "Content-Type: application/x-stuffit\n";
print "Location: $name\n\n";
close FILE;
It emails me if once the button is clicked, but I want it to email myself
one thing if the download is complete and another thing if it is canceled
or it times out.
Can Die work and any suggestions?
Does any one have any ideas.
Thanks,
Daniel
------------------------------
Date: Sun, 27 Sep 1998 08:12:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do i unpack a 64-bit long?
Message-Id: <MPG.1077f5b5dbe677e3989888@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <slrn70s8eh.f1t.adelton@aisa.fi.muni.cz> on Sun, 27 Sep 1998
11:30:25 GMT, Honza Pazdziora <adelton@fi.muni.cz> says...
> On Fri, 25 Sep 1998 21:53:48 GMT, harry@my-dejanews.com <harry@my-dejanews.com> wrote:
> > How can I read and unpack a 64-bit long integer from a file?
>
> Hardly.
>
> $ perl -e 'my $i = 1<<32; print "$i\n";'
> 1
>
> On most platforms you do not have 64 bit integers to work with.
That is quite true, but you do have floating-point numbers. In your
example,
$ perl -e 'my $f = 2 ** 32; print "$f\n";'
4294967296
Perl is as smart as Fortran -- it distinguishes $i from $f. :-)
So a partial solution to the original problem, assuming a 64-bit big-
endian integer has been read from the file into eight bytes of a string,
is:
my ($high, $low) = unpack 'NN' => $string;
my $bignum = $high * 2 ** 32 + $low;
But this fails (loses precision) when the result is too large to fit into
the mantissa of the floating-point number (52 or 53 bits). I'm sure the
Math::BigInteger or Math::BigInt modules can handle this precisely, but
can't show how as I haven't used them myself (yet?).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 27 Sep 1998 13:49:57 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: How to read contents of all *.TXT files in directory into one file?
Message-Id: <8cemsxk6m3.fsf@gadget.cscaper.com>
>>>>> "Bart" == Bart Lateur <bart.mediamind@ping.be> writes:
Bart> perl -p *.TXT >output.all
Bart> Yup, this is a command line. No script necessary.
Nope. You need at least a single statement:
perl -perl *.TXT >output.all
The script here is "rl" inserted by -e. Yeah, cute, but I can't take
credit for it.
--
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: Sun, 27 Sep 1998 09:28:05 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: How to read contents of all *.TXT files in directory into one file?
Message-Id: <6uleh5$g39$1@earth.superlink.net>
bart.mediamind@ping.be (Bart Lateur) writes:
>Michael Yevdokimov wrote:
>>
>>How to read contents of all *.TXT files in directory into one file using
>>Perl?
>perl -p *.TXT >output.all
>Yup, this is a command line. No script necessary.
Or the ever popular:
perl -e 'exec "cat *.TXT > output.all"'
:-)
David Black
dblack@saturn.superlink.net
------------------------------
Date: Sun, 27 Sep 1998 13:52:58 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: How to read contents of all *.TXT files in directory into one file?
Message-Id: <8caf3lk6h2.fsf@gadget.cscaper.com>
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:
Russ> Michael Yevdokimov <flanker@sonnet.ru> writes:
>> How to read contents of all *.TXT files in directory into one file using
>> Perl?
Russ> opendir (DIR, '/path/to/directory') or die "can't open dir: $!\n";
Russ> my @files = grep { /\.TXT$/ } readdir DIR;
Russ> closedir DIR;
Russ> open (OUTPUT, '> /path/to/output/file')
Russ> or die "can't create output file: $!\n";
Russ> for my $file (@files) {
Russ> open (INPUT, "/path/to/directory/$file")
Russ> or warn "can't open $file: $!\n";
Russ> print OUTPUT while (<INPUT>);
Russ> close INPUT;
Russ> }
Russ> close OUTPUT;
"Use the Diamond, Luke!"
{
local (*DIR,*ARGV,*OUT);
opendir DIR, "/path/to/directory" or die;
@ARGV = map "/path/to/directory/$_", grep /\.TXT$/, readdir DIR;
open OUT, ">/path/to/output/file" or die;
print OUT $_ while <>;
}
--
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: Sun, 27 Sep 1998 13:50:52 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: How to read contents of all *.TXT files in directory into one file?
Message-Id: <361242a3.26172725@nntpd.databasix.com>
On Sun, 27 Sep 1998 09:28:05 EDT, in article
<6uleh5$g39$1@earth.superlink.net>, dblack@saturn.superlink.net (David A.
Black) wrote:
>bart.mediamind@ping.be (Bart Lateur) writes:
>
>>Michael Yevdokimov wrote:
>
>>>
>>>How to read contents of all *.TXT files in directory into one file using
>>>Perl?
>
>>perl -p *.TXT >output.all
>
>>Yup, this is a command line. No script necessary.
>
>Or the ever popular:
>
>perl -e 'exec "cat *.TXT > output.all"'
>
If you're going to use a shell command, why not just cat?
cat *.txt > output.all
--
I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH! | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3 3 4 1 4 2 ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups. | Official Proof of Purchase
===========================================================================
------------------------------
Date: Sun, 27 Sep 1998 11:26:09 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: How to read contents of all *.TXT files in directory into one file?
Message-Id: <6ulleh$388$1@earth.superlink.net>
Hello -
gburnore@databasix.com (Gary L. Burnore) writes:
>On Sun, 27 Sep 1998 09:28:05 EDT, in article
><6uleh5$g39$1@earth.superlink.net>, dblack@saturn.superlink.net (David A.
>Black) wrote:
>>bart.mediamind@ping.be (Bart Lateur) writes:
>>
>>>Michael Yevdokimov wrote:
>>
>>>>
>>>>How to read contents of all *.TXT files in directory into one file using
>>>>Perl?
>>
>>>perl -p *.TXT >output.all
>>
>>>Yup, this is a command line. No script necessary.
>>
>>Or the ever popular:
>>
>>perl -e 'exec "cat *.TXT > output.all"'
>>
>If you're going to use a shell command, why not just cat?
>cat *.txt > output.all
Well, yeah, that was the point of the joke (you left out the :-) in
quoting me) - the original author had stipulated a solution "using
Perl".
David Black
dblack@saturn.superlink.net
------------------------------
Date: Sun, 27 Sep 1998 14:39:20 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: is perl better for these?
Message-Id: <360E4FA7.887F76@shaw.wave.ca>
Elaine -HappyFunBall- Ashton wrote:
>
> Look, I've been a UNIX admin for ~10 years.
Or three months shy of 8 (Reese) years. ;-)
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 27 Sep 1998 12:41:41 GMT
From: Allan@Due.net (Allan M. Due)
Subject: Re: Need help with $1 pattern
Message-Id: <6ulbq5$hgv$0@206.165.146.62>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <360e1e83.10328411@news.west.net>, melLA@west.net
(melLA@west.net) posted...
|Hi there,
|
|I 'm having a problem extracting the city name from $string as such:
|
|$match = 0;
|$string = "state=Alaska|county=Talkeetna|city=Anchorage|";
|if ($string =~ /city\s*=\s*(.+)\s*|/i)
|{
| $match = 1;
| $city = $1;
|}
|print qq(city \= $city<br>\n);
|
|But the $city value keeps turning up as undefined although $match = 1.
|I expected the value in parenthesis to contain $1, the city name. What
|am I doing wrong here?
|
|Thanks,
|Milt
|
Well, in Perl regex | is a special character meaning or. Match the
section to the left of the | or match on the right. You need to escape
it:
if ($string =~ /city\s*=\s*(.+)\s*\|/i);
by having the | unescaped, the right side of the | is behaving like:
if ($string =~ //i);
which is always successful, but probably not what you want <grin>.
HTH
--
__
Allan M. Due
Allan@Due.net
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: 27 Sep 1998 13:47:21 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Need help with $1 pattern
Message-Id: <6ulfl9$9ae$1@gellyfish.btinternet.com>
On Sun, 27 Sep 1998 11:26:42 GMT melLA@west.net wrote:
> Hi there,
> I 'm having a problem extracting the city name from $string as such:
> $match = 0;
> $string = "state=Alaska|county=Talkeetna|city=Anchorage|";
> if ($string =~ /city\s*=\s*(.+)\s*|/i)
> {
> $match = 1;
> $city = $1;
> }
> print qq(city \= $city<br>\n);
As the "|" (I got the right onie that time :) is significant as
the alternation character so must be escaped thus "\|" if it is
to considered literaly.
Just for fun consider the following:
#!/usr/bin/perl
$string = "state=Alaska|county=Talkeetna|city=Anchorage|";
%details = map { split /=/ } split /\|/, $string;
for (keys %details)
{
print $_," = ",$details{$_},"\n";
}
of course it will get whacked out of the ground by the Benchmark
Boys - it has the advantage of retaining the key/value pairs -
you could extend it to be a hash of hashes (or worse) keyed on say
cities or whatever. I would pursue it but it *is* Sunday and that
kind of stuff makes me dizzy at the best of times.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 27 Sep 1998 09:13:50 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Need help with $1 pattern
Message-Id: <6uldme$een$1@earth.superlink.net>
HEllo -
melLA@west.net writes:
>Hi there,
>I 'm having a problem extracting the city name from $string as such:
>$match = 0;
>$string = "state=Alaska|county=Talkeetna|city=Anchorage|";
>if ($string =~ /city\s*=\s*(.+)\s*|/i)
>{
> $match = 1;
> $city = $1;
>}
>print qq(city \= $city<br>\n);
>But the $city value keeps turning up as undefined although $match = 1.
>I expected the value in parenthesis to contain $1, the city name. What
>am I doing wrong here?
The '|' character at the end of your pattern is being interpreted as
the alternation character. What you're saying to the regex engine,
in essence, is: "Please match either this: /city\s*=\s*(.+)\s*/i
or this: //i" It matches the second of those options before it even
gets to the 's' in 'state'.
So - escape the | with \
David Black
dblack@saturn.superlink.net
------------------------------
Date: Sun, 27 Sep 1998 07:28:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Need help with $1 pattern
Message-Id: <81blu6.q3b.ln@flash.net>
melLA@west.net wrote:
: I 'm having a problem extracting the city name from $string as such:
: $string = "state=Alaska|county=Talkeetna|city=Anchorage|";
: if ($string =~ /city\s*=\s*(.+)\s*|/i)
^
^
You need to escape this regex metacharacter:
if ($string =~ /city\s*=\s*(.+)\s*\|/i)
^
^
: print qq(city \= $city<br>\n);
^
You don't need an escape here.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 27 Sep 1998 12:01:39 GMT
From: "Elaine -HappyFunBall- Ashton" <eashton@bbnplanet.com>
Subject: Re: perl 5 on Freebsd - dbm Problems
Message-Id: <DOpP1.18$cR3.695783@burlma1-snr1.gtei.net>
>I just installed perl5 (ver 5.00404) on my FreeBSD (ver 2.2.5) system.
>It runs fine except when I try to use any dbm commands such as
>"dbmopen." I get an error message that "dbm does not exist on this
>machine." Have I configured something incorrectly? I downloaded the
dbm is not installed with the Perl and not always installed with the OS.
Also, gdbm is not the same as dbm. Did you read the README?
e.
------------------------------
Date: 27 Sep 1998 15:32:16 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl for apache
Message-Id: <6ullq0$a3i$1@gellyfish.btinternet.com>
On 27 Sep 1998 01:42:33 GMT Wendy Liew <wendy@cs.UAlberta.CA> wrote:
> I couldn't figure out a better group to post this ...
er comp.infosystems.www.authoring.cgi
comp.infosystems.www.servers.ms-windows
> I need to write my prototype with some cgi script running on my apache
> (win32) server. If you have an example where the server simply respnod
> with all the name-value paris values and env variables for a simple
> post, please let me know. Many thanks....
I dont know if the Win32 version of Apache comes with the example stuff but
this is the script printenv from my cgi-bin directory here:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
while (($key, $val) = each %ENV) {
print "$key = $val<BR>\n";
}
Ah but you also want to get the parameter name/value pairs - OK:
#!/usr/bin/perl
use CGI qw/:standard/;
print header,
start_html("CGI Test"),
"\n";
print h1("CGI Test"),"\n";
print h2("Environment Variables"),"\n";
while (($key, $val) = each %ENV) {
print "$key = $val<BR>\n";
}
print h2("Parameters"),"\n";
for $name (param())
{
print "$name = ",param($name),"<BR>\n";
}
print end_html,"\n";
You will notice that I have used the CGI module - possibly overkill here
but as you can see it does simplify the task of getting the parameters.
I have used the procedural rather then the Object Oriented interface to
the module here as it is probably clearer to a Perl Neophyte.
CGI.pm is well documented - I wont explain what is going on in this example
but redirect you to the POD that is available with:
C:\> perldoc CGI
You should also read the various other documentation and the FAQ that
comes with the Perl distribution.
C:\> perldoc perl
> also, do I need to download perl.exe for apache 1.3.1 win32 version (if
> you happen to know )
Er, yes.
You can get the latest binary distribution from ActiveState at:
http://www.activestate.com/
or check out:
http://www.perl.com/latest.html
You should consult the Apache documentation on how to configure the server
to run Perl scripts.
> thanks,
> wendy
Nay problem
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 26 Sep 1998 16:59:46 GMT
From: Tom.Horsley@worldnet.att.net (Thomas A. Horsley)
Subject: Re: POLL: Perl features springing into your face
Message-Id: <uu31u24jo.fsf@worldnet.att.net>
> c) difference in scope of my and local, of if and when
I think I'd restate this one a bit as:
use of "my" outside of a subroutine (inside a routine, it makes
just about infinitely more sense to use my than local, outside of
a routine, I don't know what good either of them are :-).
Another one I'd add to the list is:
Use of nested subs. They don't have proper "lexical" nesting
(perl doesn't pass static links around), so what they are is really
some sort of useless nonsense that can only cause trouble (not
to mention making it next to impossible to define "proper" nested
routines someday due to backwards compatibility issues).
While we're talking about pet peeves, I'd also add:
barewords - if you want a quoted string, for gosh sakes put $#@!
quotes around it!
--
>>==>> The *Best* political site <URL:http://www.vote-smart.org/> >>==+
email: Tom.Horsley@worldnet.att.net icbm: Delray Beach, FL |
<URL:http://home.att.net/~Tom.Horsley> Free Software and Politics <<==+
------------------------------
Date: Sun, 27 Sep 1998 10:21:32 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Returning a "near" hash key.
Message-Id: <6ulhlc$nl9$1@earth.superlink.net>
Hello -
mjd@op.net (Mark-Jason Dominus) writes:
>In article <6uhg6b$k6s$1@earth.superlink.net>,
>David A. Black <dblack@saturn.superlink.net> wrote:
>>I'm posting this in the hope of flushing out a truly slender and
>>idiomatic version.
>Unless the hash is very small, it is probably better to do binary
>search than linear search.
>At first I thought that it was bizarre that there is no CPAN module
>for that. But I suppose that what that shows is that most binary
>searching problems can be solved better in Perl with a hash. This one
>is an exception.
Interesting. I wonder whether there's any future in the following
approach, which sort of rubs one hash against another and sees
what falls out:
#!/usr/local/bin/perl -w
use strict;
my %h = map { $_, uc } qw(apple banana kiwi orange);
my $k = "kiwutan";
my @sh = sort keys %h;
my $f = $sh[0];
my %s;
@s{sort(@sh, $k)} = ($f, @sh);
print "Closest key (rounding back if possible) is $s{$k}\n";
I like it, stylistically, though perhaps it's too sort-heavy to
scale very well.
David Black
dblack@saturn.superlink.net
------------------------------
Date: Sun, 27 Sep 1998 16:37:23 +0200
From: Robert Krueger <krueger@signal7.de>
Subject: threaded Perl 5.005 on HP-UX 10.20 anyone?
Message-Id: <360E4DA3.FE48CF36@signal7.de>
--------------2CAEB83C5688059C04357276
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hi,
has anyone managed to compile a threaded Perl 5.005 on HP-UX 10.20 ?
If so, I would be interested in the steps that were necessary to achieve
this,
since I'm having problems getting there.
Robert
--
(-) Robert Kr|ger
(-) SIGNAL 7 Gesellschaft f|r Softwareentwicklung und neue Medien mbH
(-) Br|der-Knau_-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665371, Fax: 06151 665373
(-) krueger@signal7.de, www.signal7.de
--------------2CAEB83C5688059C04357276
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Hi,
<P>has anyone managed to compile a threaded Perl 5.005 on HP-UX 10.20 ?
<BR>If so, I would be interested in the steps that were necessary to achieve
this,
<BR>since I'm having problems getting there.
<P>Robert
<BR>
<PRE>--
(-) Robert Krüger
(-) SIGNAL 7 Gesellschaft für Softwareentwicklung und neue Medien mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665371, Fax: 06151 665373
(-) krueger@signal7.de, www.signal7.de</PRE>
</HTML>
--------------2CAEB83C5688059C04357276--
------------------------------
Date: Sun, 27 Sep 1998 10:53:33 -0400
From: "caustic" <caustic@causticinteractive.nospam.com>
Subject: using grep to snag patterns from another file
Message-Id: <356c3874.0@newsprime.tidalwave.net>
hi,
i'm still having problems trying to get a script to pull lines out of a flat
file. and let me tell you, this has been exasperating. i know that the
script must be simple, but i've been working on this for 2 days now!
the need:
to create a script that searches "news.html" for every line that looks
similar to the following:
<headline><b>Headline 1</b></headline><br>
and only prints the first 3 it finds (which would be the latest news).
i can grep the file from the command line (grep headline news.html) but
can't seem to get a regular expression to work in my perl script.
everything i run across is directed to searching for a pattern within the
same document, not an external one.
any ideas?
thanks a ton,
keith
don't you just hate it when designers pretend to be programmers?
------------------------------
Date: Sun, 27 Sep 1998 11:29:23 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: using grep to snag patterns from another file
Message-Id: <6ullkj$3gv$1@earth.superlink.net>
Hello -
"caustic" <caustic@causticinteractive.nospam.com> writes:
>hi,
>i'm still having problems trying to get a script to pull lines out of a flat
>file. and let me tell you, this has been exasperating. i know that the
>script must be simple, but i've been working on this for 2 days now!
>the need:
>to create a script that searches "news.html" for every line that looks
>similar to the following:
><headline><b>Headline 1</b></headline><br>
>and only prints the first 3 it finds (which would be the latest news).
>i can grep the file from the command line (grep headline news.html) but
>can't seem to get a regular expression to work in my perl script.
>everything i run across is directed to searching for a pattern within the
>same document, not an external one.
I'm not sure what you mean by that last sentence. I don't know of very
many program files that search themselves.
Anyway, can you post some (non-working) code so that we can see exactly
what/where the problem is?
David Black
dblack@saturn.superlink.net
------------------------------
Date: Sun, 27 Sep 1998 08:44:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: using grep to snag patterns from another file
Message-Id: <MPG.1077fd4d5d8d8561989889@nntp.hpl.hp.com>
In article <356c3874.0@newsprime.tidalwave.net> on Sun, 27 Sep 1998
10:53:33 -0400, caustic <caustic@causticinteractive.nospam.com> says...
...
> to create a script that searches "news.html" for every line that looks
> similar to the following:
> <headline><b>Headline 1</b></headline><br>
>
> and only prints the first 3 it finds (which would be the latest news).
#!/usr/local/bin/perl -w
use strict;
my $n = 0;
open IN, "news.html" or die "Couldn't open 'news.html'. $!\n";
while (<IN>) {
print, ++$n == 3 && last if m|<headline><b>.*</b></headline><br>|;
}
or, less obscurely perhaps (but I like one-liners :-),
next unless m|<headline><b>.*</b></headline><br>|;
print;
last if ++$n == 3;
If you just want to print the headlines, that one-liner changes to:
print("$1\n"), ++$n == 3 && last
if m|<headline><b>(.*)</b></headline><br>|;
> i can grep the file from the command line (grep headline news.html) but
> can't seem to get a regular expression to work in my perl script.
> everything i run across is directed to searching for a pattern within the
> same document, not an external one.
I don't understand your distinction between 'the same document' or 'an
external one'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3836
**************************************