[11643] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5243 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 28 09:03:01 1999

Date: Sun, 28 Mar 99 06:00:21 -0800
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, 28 Mar 1999     Volume: 8 Number: 5243

Today's topics:
        Building 5.005_02 - error with pipe.t <wayne.izatt@myself.com>
    Re: dumping db header row before display <tlc@noble.cioe.com>
    Re: dumping db header row before display (Sam Holden)
        file sunroutines <amwalker@gate.net>
        How can I run PERL CGIs with Apache 1.3.6 for Windows? (Michael Compton)
    Re: How can I run PERL CGIs with Apache 1.3.6 for Windo <gellyfish@gellyfish.com>
    Re: Input Password <hlee@ccserv2.ee.ntu.edu.tw>
    Re: internal server error <tony@cyberscape.net>
    Re: Newbie ques., clearing an array (David Cantrell)
    Re: Passing parameters (Randal L. Schwartz)
    Re: Passing parameters (brian d foy)
    Re: Passing parameters <ffchopin@worldnet.att.net>
        Perl Mongers Cumbria UK <tony@cyberscape.net>
        perl port for 16-bit MSDOS? <nbhoh1@moa.norges-bank.no>
    Re: Q: redefined subroutines <jacklam@math.uio.no>
        RE to match one line of Larry's quote <555034897s@acadiau.ca>
    Re: RE to match one line of Larry's quote <555034897s@acadiau.ca>
    Re: RE to match one line of Larry's quote (Larry Rosler)
    Re: Require Question <gellyfish@gellyfish.com>
    Re: Simple Question :-) <ophir@saifun.com>
    Re: Split with + , but no %2B <debot@xs4all.nl>
        system ('myproc &'); sstarre@my-dejanews.com
    Re: tie-ing 1000+ hashes is failing. help! <ebohlman@netcom.com>
    Re: Where to start with Perl (Randal L. Schwartz)
        why doesn't this work? <amwalker@gate.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 28 Mar 1999 08:36:39 GMT
From: Wayne Izatt <wayne.izatt@myself.com>
Subject: Building 5.005_02 - error with pipe.t
Message-Id: <36D8FF77.9EEF4CA2@myself.com>

I've just finished building 5.005_02 on my linux 1.2.13 kernel. All the
tests in the test suite finished successfully except pipe.t in the io
group. Any idea why? The same test failed when I built 5.004 last year.

It may be related to the kernel version (and I don't think my laptop
with 4 megs of ram is ready for kernel 2.x.x). I've looked at the code,
and can't see why it should go wrong.

This is a good challenge for all would be gurus ;-)

#!./perl

# $RCSfile: pipe.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:31 $

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';
    require Config; import Config;
    unless ($Config{'d_fork'}) {
	print "1..0\n";
	exit 0;
    }
}

$| = 1;
print "1..12\n";

open(PIPE, "|-") || (exec 'tr', 'YX', 'ko');
print PIPE "Xk 1\n";
print PIPE "oY 2\n";
close PIPE;

if (open(PIPE, "-|")) {
    while(<PIPE>) {
	s/^not //;
	print;
    }
    close PIPE;        # avoid zombies which disrupt test 12
}
else {
    print STDOUT "not ok 3\n";
    exec 'echo', 'not ok 4';
}

pipe(READER,WRITER) || die "Can't open pipe";

if ($pid = fork) {
    close WRITER;
    while(<READER>) {
	s/^not //;
	y/A-Z/a-z/;
	print;
    }
    close READER;     # avoid zombies which disrupt test 12
}
else {
    die "Couldn't fork" unless defined $pid;
    close READER;
    print WRITER "not ok 5\n";
    open(STDOUT,">&WRITER") || die "Can't dup WRITER to STDOUT";
    close WRITER;
    exec 'echo', 'not ok 6';
}


pipe(READER,WRITER) || die "Can't open pipe";
close READER;

$SIG{'PIPE'} = 'broken_pipe';

sub broken_pipe {
    $SIG{'PIPE'} = 'IGNORE';       # loop preventer
    print "ok 7\n";
}

print WRITER "not ok 7\n";
close WRITER;
sleep 1;
print "ok 8\n";

# VMS doesn't like spawning subprocesses that are still connected to
# STDOUT.  Someone should modify tests #9 to #12 to work with VMS.

if ($^O eq 'VMS') {
    print "ok 9\n";
    print "ok 10\n";
    print "ok 11\n";
    print "ok 12\n";
    exit;
}

if ($Config{d_sfio} || $^O eq machten || $^O eq beos) {
    # Sfio doesn't report failure when closing a broken pipe
    # that has pending output.  Go figure.  MachTen doesn't either,
    # but won't write to broken pipes, so nothing's pending at close.
    # BeOS will not write to broken pipes, either.
    print "ok 9\n";
}
else {
    local $SIG{PIPE} = 'IGNORE';
    open NIL, '|true'	or die "open failed: $!";
    sleep 2;
    print NIL 'foo'	or die "print failed: $!";
    if (close NIL) {
	print "not ok 9\n";
    }
    else {
	print "ok 9\n";
    }
}

# check that errno gets forced to 0 if the piped program exited non-zero
open NIL, '|exit 23;' or die "fork failed: $!";
$! = 1;
if (close NIL) {
    print "not ok 10\n# successful close\n";
}
elsif ($! != 0) {
    print "not ok 10\n# errno $!\n";
}
elsif ($? == 0) {
    print "not ok 10\n# status 0\n";
}
else {
    print "ok 10\n";
}

# check that status for the correct process is collected
wait;				# Collect from $pid
my $zombie = fork or exit 37;
my $pipe = open *FH, "sleep 2;exit 13|" or die "Open: $!\n";
$SIG{ALRM} = sub { return };
alarm(1);
my $close = close FH;
if ($? == 13*256 && ! length $close && ! $!) {
    print "ok 11\n";
} else {
    print "not ok 11\n# close $close\$?=$?   \$!=", $!+0, ":$!\n";
};
my $wait = wait;
if ($? == 37*256 && $wait == $zombie && ! $!) {
    print "ok 12\n";
} else {
    print "not ok 12\n# pid=$wait first=$pid pipe=$pipe zombie=$zombie
me=$$ \$?=$?   \$!=", $!+0, ":$!\n";
}


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

Date: Sun, 28 Mar 1999 08:16:29 -0500
From: "tlcora" <tlc@noble.cioe.com>
Subject: Re: dumping db header row before display
Message-Id: <41qL2.427$45.3098@news.goodnet.com>

cc to Sam:

A dollar to anyone in this newsgroup who feels dumber than I do now.

The first (and 5 subsequent) readings of Sam's solution, I blew right past
his suggestion of "<DATABASE>;" thinking it was part of the original code
and focused on his summary statement. duh...

It is this type of sloppy carelessness that will prevent me from ever being
a good programmer (or even a bad one).

I apologize for this and will spend some time trying to understand why the
following is true.

open (DATABASE, "$datafile"); # opens $datafile and assigns the file handle
DATABASE

<DATABASE>; # ignores first line of $datafile

(<DATABASE>); # also ignores first line of $datafile - () not necessary
unless I want to flaunt my lack of understanding - however - "When in doubt,
parenthesize. At the very least it will let some poor schmuck bounce on the
% key in vi. ^p Even if you aren't in doubt, consider the mental welfare of
the person who has to maintain the code after you, and who will probably put
parentheses in the wrong place." - ch 8 - Other Oddments
- Camel book

while (<DATABASE>) # includes first line of $datafile during processing of
the while statement - go figure

My hat is off to those of you who really have a firm grasp on these little
idiosyncrasies. You probably got good grades in English (or other applicable
native language study course) too:)

Thanks again for the help!

Sam Holden wrote in message ...
>On Thu, 25 Mar 1999 22:52:26 -0500, tlcora <tlc@noble.cioe.com> wrote:
>>I have a flat text data file.  The first row is the header row and I want
to
>>remove it before displaying the entries.  Everything else works fine, but
I
>>can't figure out which perl function to use to remove only the header row
>>prior to displaying.  I've looked through the faq several times and also
>>searched dejanews using several parameters, yet still can't quite figure
it
>>out.  Most of the postings deal with deleting a line in a file (faq5), but
I
>>can't seem to adapt anything to get it to work. Faq4 deals with data, but
I
>>couldn't find a solution here either. I don't want to edit the file at
this
>>point, just display the entries without the header row. Could someone
point
>>me in the right direction?
>>
>>commented to show my understanding (or lack there of) of each line.
>>
>>open (DATABASE, "$datafile");    # will add error checking later
>
><DATABASE>; #add this line and you will discard the first line of input...
>
>>while (<DATABASE>)
>>{
>>$row = $_;      # puts all of the database file into the scalar $row
>>chop $row;        # gets rid of \n at the end of the file
>>@fields = split (/\|/, $row);   # splits each of the fields delimited by |
>>and places them in an array
>>print "...<html for @fields snipped>  # outputs the contents of @fields to
>>the browser
>>close (DATABASE);  # closes $datafile
>>}
>
>All you have to do is decide what you want done and do it. You want to
>ignore the first line, well read it in and ignore it.
>
>--
>Sam
>
>Perl was designed to be a mess (though in the nicest of possible ways).
> --Larry Wall




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

Date: 28 Mar 1999 13:45:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: dumping db header row before display
Message-Id: <slrn7fsckj.pr9.sholden@pgrad.cs.usyd.edu.au>

On Sun, 28 Mar 1999 08:16:29 -0500, tlcora <tlc@noble.cioe.com> wrote:
>cc to Sam:
>
>The first (and 5 subsequent) readings of Sam's solution, I blew right past
>his suggestion of "<DATABASE>;" thinking it was part of the original code
>and focused on his summary statement. duh...

I'll try to make my additions clearer from now on.

>
>It is this type of sloppy carelessness that will prevent me from ever being
>a good programmer (or even a bad one).

I'm sure every one who has written anything slightly more complex
then hello world has got stuck on a bug for hours and hours. Only to
discover that they :

1) were editing one file and running one with the same name in another
	directory
2) discovering the code was correct and they had made a mistake on the
	test code.
3) used the wrong variable (still a variable so -w didn't flag it)
4) had made an error in that code that was 'definantly correct' and thus
	they hadn't looked at closely.

I know I've done at least 2 of them, and I've seen them all - over and over
in third year student code.

>I apologize for this and will spend some time trying to understand why the
>following is true.
>
>open (DATABASE, "$datafile"); # opens $datafile and assigns the file handle
>DATABASE

You should always use 
open(DATABASE, $datafile) || die "Unable to open $datafile : $!";

One day you'll spend hours debugging if you don't. (Also quoting a single
variable is unnecessary, and most people find it harms readability).
>
><DATABASE>; # ignores first line of $datafile

Because the < ... > operator is defined as reading a line from the filehandle
and returning it in a scalar context, or reading the whole file and returning
all the lines in a list context.

$line = <DATABASE>;
would thus read one line from DATABASE.

Since you don't assign the line to anything perl throws it away.

>
>(<DATABASE>); # also ignores first line of $datafile - () not necessary
>unless I want to flaunt my lack of understanding - however - "When in doubt,
>parenthesize. At the very least it will let some poor schmuck bounce on the
>% key in vi. ^p Even if you aren't in doubt, consider the mental welfare of
>the person who has to maintain the code after you, and who will probably put
>parentheses in the wrong place." - ch 8 - Other Oddments
>- Camel book

I would personally not use the ()s since it looks like you are trying to
put it in a list context (and thus read the whole file) - it doesn't and you
aren't, but at first glance that's what I would think it was doing. The
very next question would of course by - 'why bother reading it and throwing it 
all away'.

I believe the Camel quote is in the context of precedence in expressions,
and since there is no precedence to worrry about there's no need for them
here.

>
>while (<DATABASE>) # includes first line of $datafile during processing of
>the while statement - go figure

<DATABASE> as mentioned above returns the next line of DATABASE. The while
then tests to see if anything was read (I'm skipping over what it really
does - it's a special case which follows DWIM). Thus if something was
read it will execute the loop (after setting $_ to be the read line (another
bit of magic)). Then it will go back and read the next line. Finally
when there is nothing left to read from DATABASE, the test for existance of
a line will fail and the while will terminate.
>
>My hat is off to those of you who really have a firm grasp on these little
>idiosyncrasies. You probably got good grades in English (or other applicable
>native language study course) too:)

The stuff you mentioned was really just building things out of little pieces.

I would suggest reading the perlop and perlsyn documentation.

-- 
Sam

comments on data are usually much more helpful than on algorithms
	--Rob Pike


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

Date: Sun, 28 Mar 1999 07:37:39 -0500
From: Aaron Walker <amwalker@gate.net>
Subject: file sunroutines
Message-Id: <36FE2292.984DE2FF@gate.net>

are there subroutines in perl that do chmod, copy and move?
I'd like to chmod a tempfile so its writeable, then copy the tempfile to
a datafile.
Do these exist and can I use them in a CGI?

thanks,
Aaron



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

Date: 27 Mar 1999 21:22:22 -0800
From: compton@best.com (Michael Compton)
Subject: How can I run PERL CGIs with Apache 1.3.6 for Windows?
Message-Id: <7dkeae$q4m$1@shell3.ba.best.com>

Hello,

(I'm not sure if this is the proper newsgroup for this question, but thought
 I'd give it a try).

I'm trying to get PERL5 CGI scripts running with Apache 1.3.6 on my Windows95
machine.  I have a good PERL.EXE in my cgi-bin directory, and my test.cgi
script works fine when invoked from an MS-DOS command line.  However, when I
try to invoke it via the server, I get a server error "unable to spawn child
process".  The first line of my script is "#!PERL.EXE".  I've tried with
script extenions of .cgi, .pl, and .exe  with no luck.

Is there something else I need to do?

Thanks in advance for any help,
-Michael Compton
 compton@best.com


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

Date: 28 Mar 1999 11:29:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How can I run PERL CGIs with Apache 1.3.6 for Windows?
Message-Id: <7dl0ai$fc$1@gellyfish.btinternet.com>

On 27 Mar 1999 21:22:22 -0800 Michael Compton wrote:
> 
> I'm trying to get PERL5 CGI scripts running with Apache 1.3.6 on my Windows95
> machine.  I have a good PERL.EXE in my cgi-bin directory, 

Do not do that.  There is a widely know CERT advisory on this practice and
I guess a widely known script to detect and exploit it.  If you cant get
Perl to work when you install it properly then perhaps you are doing something
else wrong.  With recent versions of Perl for Win32 it is also a bad idea
for other reasons too.  I really hope you werent following the advice of
someone you trust.

>                                                              and my test.cgi
> script works fine when invoked from an MS-DOS command line.  However, when I
> try to invoke it via the server, I get a server error "unable to spawn child
> process".  The first line of my script is "#!PERL.EXE".  I've tried with
> script extenions of .cgi, .pl, and .exe  with no luck.
> 
> Is there something else I need to do?

Install your Perl properly first.  Then set your shebanh line to the full
path to the executable eg:

#!c:/perl/bin/perl.exe

I know this works.

Any other problems that you might have around this (for instance those that
caused you to incorrectly install Perl in the first place ) are probably
to do with the servers configuration.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 28 Mar 1999 05:35:31 GMT
From: Huang Lee <hlee@ccserv2.ee.ntu.edu.tw>
Subject: Re: Input Password
Message-Id: <7dkf33$e1g$1@gemini.ntu.edu.tw>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On 27 Mar 1999 16:50:39 GMT Huang Lee wrote:
> > 
> > but now,if I want to add another function like "Press any key to stop".
> > I mean I can input "one key" without ENTER.
> > and the program will not stop.until I type something....
> > what should I do....(Under telnet mode,I am server on unix)
> fish,seeds,tools, Term::ReadKey ...
Sorry...
I do not really understand your words.
I have tried "Term::ReadKey",but it can not work between server and client.

-- 
My HomePage URL:http://www.ee.ntu.edu.tw/~hlee/


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

Date: Sun, 28 Mar 1999 14:00:51 +0100
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Re: internal server error
Message-Id: <922625743.9252.0.nnrp-03.c2de1237@news.demon.co.uk>

Couldn't it be something as simple as an error in the script causing the
'internal server error' (assuming 500 error)
 ...

Tony




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

Date: Sun, 28 Mar 1999 12:53:31 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Newbie ques., clearing an array
Message-Id: <36ff2158.164398893@thunder>

On Sat, 27 Mar 1999 16:13:03 GMT, njc@dmc.uucp (Neil Cherry)
enlightened us thusly:

>I have 2 books on Perl and I find the arrays the most confusing part.
>
>Actually I have 2 questions:
>
>1) How does one clear an array after it's bee filled?

Aside from the fact that you can never fill an array, as it will
automagically grow when you add elements beyond the current end of the
array, try:
  @array=();

>2) How does one create a multi dimension array or an array of structures?

See 'perldoc perldsc' which explains it far better than I could ;-)

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: 27 Mar 1999 20:15:04 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Passing parameters
Message-Id: <m1aewys113.fsf@halfdome.holdit.com>

>>>>> "Jason" == Jason Simms <ffchopin@worldnet.att.net> writes:

>> Also, read the CGI chapter in Learning Perl, by Christiansen et al.
Jason> Sorry Randle, should have had your name there(!)...

Well, actually, the CGI chapter *was* written primarily by Tom.  So, I
didn't blink too hard when you said that, but I was curious about how
you'd gotten that piece of inside information. :)

-- 
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, 28 Mar 1999 01:52:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Passing parameters
Message-Id: <comdog-ya02408000R2803990152510001@news.panix.com>

In article <m1aewys113.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) posted:

> >>>>> "Jason" == Jason Simms <ffchopin@worldnet.att.net> writes:
> 
> >> Also, read the CGI chapter in Learning Perl, by Christiansen et al.
> Jason> Sorry Randle, should have had your name there(!)...
> 
> Well, actually, the CGI chapter *was* written primarily by Tom.  So, I
> didn't blink too hard when you said that, but I was curious about how
> you'd gotten that piece of inside information. :)

it's not a subtle change in writing style ;)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 28 Mar 1999 07:06:01 GMT
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Passing parameters
Message-Id: <7dkkcp$dmb@bgtnsc03.worldnet.att.net>

I know, I know...  I noticed it immediately after posting, and then I came
across it later as well.  I really do know how to spell, HONEST. :-)

Jason Simms

Jonathan Stowe wrote in message <7dk5a3$2d9$1@gellyfish.btinternet.com>...
>On Sat, 27 Mar 1999 21:01:14 -0500 Jason Simms wrote:
>>> Also, read the CGI chapter in Learning Perl, by Christiansen et al.
>>
>> Sorry Randle, should have had your name there(!)...
>>
>
>Is this a new take on the Schwartzian Transform ? This is the second
>similar rendering I have seen today .





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

Date: Sun, 28 Mar 1999 14:02:59 +0100
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Perl Mongers Cumbria UK
Message-Id: <922625871.9309.0.nnrp-03.c2de1237@news.demon.co.uk>

Looking for other Perlgrammers in and around Cumbria, UK to set up a Perl
Mongers group.  Currently there are 3/4 (thats 3 or 4, not three quarters)
people interested.

Please direct any responses to tony@cyberscape.net

Tony Kenny
Nr. Kendal, Cumbria




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

Date: Sun, 28 Mar 1999 13:01:54 +0200
From: "Hans Olav Husum" <nbhoh1@moa.norges-bank.no>
Subject: perl port for 16-bit MSDOS?
Message-Id: <7dl25p$d06$1@elle.eunet.no>

Please don't laugh: I would like to get hold of a binary dostribution of a
perl port that runs under MSDOS 3.3 on an 8086. Going back to version 3 or 4
is OK (and probably necessary).

Can anyone point me in the right direction?

Hans Olav Husum




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

Date: Sun, 28 Mar 1999 12:13:57 +0200
From: Peter John Acklam <jacklam@math.uio.no>
Subject: Re: Q: redefined subroutines
Message-Id: <36FE00E5.54D851B2@math.uio.no>

Jonathan Stowe wrote:
> 
> Peter John Acklam wrote:
> >
> > (...)
> 
> I didnt get these results when I tried something using those modules -
> so it is possibly a problem with the way that Perl is built or there
> is something going on in your code that you are not telling us about.

Thanks for the reply, but the code I gave was actually all there was.
And I get the same even when I use just an EMPTY one-liner:

  c:\> perl -MFile::Spec -MDirhandle -we ""
  Subroutine new redefined at E:\PERL\lib/Dirhandle.pm line 32.
  Subroutine DESTROY redefined at E:\PERL\lib/Dirhandle.pm line 43.
  (...)

Peter

-- 
Peter J. Acklam - jacklam@math.uio.no - http://www.math.uio.no/~jacklam



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

Date: Sun, 28 Mar 1999 00:00:30 -0400
From: Tong <555034897s@acadiau.ca>
Subject: RE to match one line of Larry's quote
Message-Id: <36FDA95D.4272479C@acadiau.ca>

Hi, 

I want to sort out all Larry's one line quote. I.e.:

====
%%
And don't tell me there isn't one bit of difference between null and
space,
because that's exactly how much difference there is.  :-)
             -- Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>
%%
"And I don't like doing silly things (except on purpose)."
             -- Larry Wall in <1992Jul3.191825.14435@netlabs.com>
%%
 ...
====

Only the 2nd quote got print out. But I just can't find a right RE to
get it. If you are curious, here are all that I could think about and
tried. And none of them seems working.

====
perl -ne "$/ = ''; print $& if /\s*\n.*?\n\s+-- /" lwall-q.txt
perl -ne "$/ = ''; print $& if /\n\s*\n.*?\n\s+-- /" lwall-q.txt

perl -ne "$/=''; print $& if /^\s*$/" lwall-q.txt

perl -ne "$/ = ''; print $& if /\n\n.*?/" lwall-q.txt
perl -ne "$/ = ''; print $& if /\n\n.*?\n/" lwall-q.txt
perl -ne "$/ = ''; print $& if /\n\n[^\n]+\n/" lwall-q.txt
perl -ne "$/ = ''; print $& if /\n\n[^\n]*\n/" lwall-q.txt
perl -ne "$/ = ''; print $& if /\n\n[^\n]*/" lwall-q.txt

perl -ne "$/ = ''; print $& if   /\n[^\n]+\n[^n]+\n/" lwall-q.txt
perl -ne "$/ = ''; print $& if /\n\n[^\n]+\n[^n]+\n/" lwall-q.txt
perl -ne "$/ = ''; print $& if         /\n\n[^n]+\n/" lwall-q.txt

perl -ne "$/ = ''; print $& if         /\n\n[^n]+\n/m" lwall-q.txt
perl -ne "$/ = ''; print $& if         /\n\n[^n]+\n/ms" lwall-q.txt

perl -ne "$/ = ''; print   $1 $2     if /\n([^\n]+)\n([^n]+)\n\s+--/"
lwall-q.txt
perl -ne "$/ = ''; print \"$1 $2\n\" if   /([^\n]*)\n([^n]+)\n\s+--
Larry/" lwall-q.txt >r
====

I really need you to shed a light on it. Thanks!

-- 
Anti-Spam: Remove triple 5 to reply


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

Date: Sun, 28 Mar 1999 00:06:05 -0400
From: Tong <555034897s@acadiau.ca>
Subject: Re: RE to match one line of Larry's quote
Message-Id: <36FDAAAD.229081CD@acadiau.ca>



Tong wrote:
> 
> Hi,
> 
> I want to sort out all Larry's one line quote. I.e.:
> 
> ====
> %%
> And don't tell me there isn't one bit of difference between null and
> space,
> because that's exactly how much difference there is.  :-)
>              -- Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>
> %%
> "And I don't like doing silly things (except on purpose)."
>              -- Larry Wall in <1992Jul3.191825.14435@netlabs.com>
> %%
> ...
> ====
> 
> Only the 2nd quote got print out. But I just can't find a right RE to
> get it. If you are curious, here are all that I could think about and
> tried. And none of them seems working.
> 
> ====
> perl -ne "$/ = ''; print $& if /\s*\n.*?\n\s+-- /" lwall-q.txt
> perl -ne "$/ = ''; print $& if /\n\s*\n.*?\n\s+-- /" lwall-q.txt
> 
> perl -ne "$/=''; print $& if /^\s*$/" lwall-q.txt
> 
> perl -ne "$/ = ''; print $& if /\n\n.*?/" lwall-q.txt
> perl -ne "$/ = ''; print $& if /\n\n.*?\n/" lwall-q.txt
> perl -ne "$/ = ''; print $& if /\n\n[^\n]+\n/" lwall-q.txt
> perl -ne "$/ = ''; print $& if /\n\n[^\n]*\n/" lwall-q.txt
> perl -ne "$/ = ''; print $& if /\n\n[^\n]*/" lwall-q.txt
> 
> perl -ne "$/ = ''; print $& if   /\n[^\n]+\n[^n]+\n/" lwall-q.txt
> perl -ne "$/ = ''; print $& if /\n\n[^\n]+\n[^n]+\n/" lwall-q.txt
> perl -ne "$/ = ''; print $& if         /\n\n[^n]+\n/" lwall-q.txt
> 
> perl -ne "$/ = ''; print $& if         /\n\n[^n]+\n/m" lwall-q.txt
> perl -ne "$/ = ''; print $& if         /\n\n[^n]+\n/ms" lwall-q.txt
> 
> perl -ne "$/ = ''; print   $1 $2     if /\n([^\n]+)\n([^n]+)\n\s+--/"
> lwall-q.txt
> perl -ne "$/ = ''; print \"$1 $2\n\" if   /([^\n]*)\n([^n]+)\n\s+--
> Larry/" lwall-q.txt >r
> ====
> 
> I really need you to shed a light on it. Thanks!
> 

Sorry I didn't myself clear enough. I mean, can you write a RE to match
*one line* of Larry's quote from "%%" to " -- Larry Wall"? If not, then
any RE that can pick out one line of Larry's quote will do.

Thanks! 

-- 
Anti-Spam: Remove triple 5 to reply


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

Date: Sat, 27 Mar 1999 22:49:53 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: RE to match one line of Larry's quote
Message-Id: <MPG.116770edffac4b229897df@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <36FDAAAD.229081CD@acadiau.ca> on Sun, 28 Mar 1999 00:06:05 -
0400, Tong <555034897s@acadiau.ca >says...
> Tong wrote:
> > I want to sort out all Larry's one line quote. I.e.:
> > 
> > ====
> > %%
> > And don't tell me there isn't one bit of difference between null and
> > space,
> > because that's exactly how much difference there is.  :-)
> >              -- Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>
> > %%
> > "And I don't like doing silly things (except on purpose)."
> >              -- Larry Wall in <1992Jul3.191825.14435@netlabs.com>
> > %%
 ...
> Sorry I didn't myself clear enough. I mean, can you write a RE to match
> *one line* of Larry's quote from "%%" to " -- Larry Wall"? If not, then
> any RE that can pick out one line of Larry's quote will do.

One such regex would be:

  /^%%\s+(.*?)\s+-- Larry Wall/ms

where the quote proper is captured in $1.

But perhaps a better approach than slurping the whole file and attacking 
it with a regex would be to set $/ to "%%\n" and get the intervening 
stuff on each readline.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: 28 Mar 1999 11:17:53 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Require Question
Message-Id: <7dkvkh$f8$1@gellyfish.btinternet.com>

On Sun, 28 Mar 1999 04:00:26 +0100 Mike Watkins wrote:
> Hi there,
> 
> Why is it, on some UNIX web servers out there, the 'require' function won't
> work in perl.  Instead, it just gives off a 500 Internal Server Error?  I
> then tried the line:
>     eval { require "file.pl"; };
> 
> That didn't give off the 500 error, but it didn't load the file either.
> 

Perl doesnt have such an error.

Have you checked in the server error_log to see what the real error is ?

Otherwise you might try either using the advice given in perlfaq9.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 28 Mar 1999 11:11:39 +0200
From: Ophir Marko <ophir@saifun.com>
Subject: Re: Simple Question :-)
Message-Id: <36FDF24B.D8BE6B8D@saifun.com>

Thanks, but what I'm trying to do is find a certain word in the text, copy the
whole line in which it appears to a file and then close both files.

Thanks,
Ophir Marko

Oscar Frowijn wrote:

> >#!/usr/bin/perl -w
> >
> >open FILE1, 'file1' or die "open file1: $!\n";
> >open FILE2, 'file2' or die "open file2: $!\n";
> >open FILE3, 'file3' or die "open file3: $!\n";
> >
> >my ($line1, $line2, $line3);
> >
> >LOOP:
> >while ( 1 ) {
> >    $line1 = <FILE1>;
> >    $line2 = <FILE2>;
> >    $line3 = <FILE3>;
> >
> >    last LOOP if ( defined($line1) + defined($line2) + defined($line3) ==
> 0 );
> >
> >    for ( $line1, $line2, $line3 ) {
> >        $_ = defined($_) ? $_ : "";
> >        chomp;
> >    }
> >
> >    printf "%s%s%s\n", $line1, $line2, $line3;
> >}
> >
> >close FILE1;
> >close FILE2;
> >close FILE3;
> >
>
> This will do the trick :-)
>
> Thanks a lot !!!!



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

Date: Sun, 28 Mar 1999 15:14:20 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Split with + , but no %2B
Message-Id: <36FE2B2C.EE4DE6E5@xs4all.nl>

Ok, here it is:
This is the Query string: q=Free+%2BPerl+Scripts

@array = split (/\+/, $in{'q'});

The arrays are:
$array[0] = Free
$array[1] = (empty)
$array[2] = Perl
$array[3] = Scripts

But I want it to be this way:

$array[0] = Free
$array[1] = +Perl
$array[2] = Scripts


"David L. Cassell" wrote:

> Frank de Bot wrote:
> >
> > %2B is + in the Query string. The way you say doesn't work.
> >
> > brian d foy wrote:
> >
> > > In article <36FD477E.D90081AD@xs4all.nl>, Frank de Bot <debot@xs4all.nl> posted:
> > >
> > > > Is there anyway to split a string with + while %2B stays ?
> > >
> > >    @list = split /\+/, $string;
> > >
> > > i'm trying to think how you are doing it so that there is a
> > > problem...
>
> Perhaps you need to show us a little code, to demonstrate the
> problem you're having.  Brian's guess was as good a guess as you
> should expect for a no-context-whatsoever situation.
>
> David
> --
> David L. Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician



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

Date: Sun, 28 Mar 1999 05:21:02 GMT
From: sstarre@my-dejanews.com
Subject: system ('myproc &');
Message-Id: <7dke7o$a2l$1@nnrp1.dejanews.com>

When started from CGI, the browser waits until the background process
finishes. This is an expected result. Is there a way to run the process
detached and to not have the parent wait for it to complete?

Cheers & thanks!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 28 Mar 1999 06:26:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: tie-ing 1000+ hashes is failing. help!
Message-Id: <ebohlmanF9AKKp.50F@netcom.com>

Charles Marsh <princecharles7045@my-dejanews.com> wrote:
: Is there a better way to load my data so I don't need so many hashes but I can
: still tie them? What I'd really like is to have $data{sym}{field} be my data
: structure, but that isn't possible and to tie, right?

With MLDBM, it is.



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

Date: 27 Mar 1999 20:13:03 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Where to start with Perl
Message-Id: <m1emmas14g.fsf@halfdome.holdit.com>


[note: comp.lang.perl is dead.  please stop posting there.]

>>>>> "David" == David L Cassell <cassell@mail.cor.epa.gov> writes:

David> richb@ezl.com wrote:
>> I learned Perl by reading the book "Learning Perl" by Randle Schwartz and
>> worked all the examples. Then I bought "Perl in a Nutshell". Two very good
>> books. If you have programmed in C, you won't have a problem picking it up.
>> I was a REXX programmer in a previous life and I've programmed in C and C++.
>> Perl makes things much easier to do than any other language I've used. Good
>> Luck! Rich

David> s/Randle/Randal/

And besides the other obvious alternate spelling for my first name,
I've seen at least two more.  And when you cross-product that with all
the wonderful ways to spell my last name, the odds of anyone getting
it right are pretty small.

Oddly enough, even though the covers on my four books have the name
spelled right, O'Reilly still sends the quarterly checks to 'Randall
[sic] Schwartz'.  Duh.

-- 
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, 28 Mar 1999 08:44:48 -0500
From: Aaron Walker <amwalker@gate.net>
Subject: why doesn't this work?
Message-Id: <36FE3250.3937F0D5@gate.net>

I have a cgi script that deletes a line from a file based no whether or
not the line was found with a RE.
When I use a form for the interface to the script, it tries to call the
script, but sits there until it times out.
If I try to run the script from the shell, I get nothing; it just sits
there.

Here's the script:

#!/usr/bin/perl
require("cgi-lib.pl");

&ReadParse(*input);
$del = $input{'del'};

open(FILE, "/home/httpd/cgi-bin/catalog.dat");
@data = <FILE>;
close(FILE);

open(TEMP, ">/home/httpd/cgi-bin/catalog.dat");
foreach $i (@data)
{
     while($i !~ /$del/i)
     {
          print TEMP "$i\n";
     }
}
close(TEMP);

print "Content-type: text/html\n\n";
print "<html><body><a href=\"/cgi-bin/catalog.pl?view\">Back to
catalog</a>";
print "</body></html>";

Any ideas why this doesn't work?  It looks pretty straitfoward to me.

Thanks,
Aaron



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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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