[11953] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5553 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 3 19:07:16 1999

Date: Mon, 3 May 99 16:00:23 -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           Mon, 3 May 1999     Volume: 8 Number: 5553

Today's topics:
    Re: "learning perl" does not seem to be written well <keithmur@mindspring.com>
    Re: Filehandle Question <emschwar@rmi.net>
    Re: Filehandle Question <t-armbruster@ti.com>
        Fractional numbers..? <computertech@clara.net>
    Re: Fractional numbers..? <cassell@mail.cor.epa.gov>
    Re: Fractional numbers..? (Larry Rosler)
        Grrr ... rsh refuses to work out of cron matt@matt.com
        Grrrr .... rsh from cron refuses to work matt@matt.com
    Re: How to get perl to get data via FTP and other TCP/I (I R A Aggie)
    Re: How to implement array of structure in perl <acox@cv.telegroup.com>
        ISPs that offer cgi space?? <mflaherty2@earthlink.net>
        looking at directories <enigma@turingstudio.com>
    Re: looking at directories <cassell@mail.cor.epa.gov>
        Looking for clever way to swap file sections <markg@jup.com>
    Re: Looking for clever way to swap file sections <uri@sysarch.com>
    Re: Newbie in need (reading a file into an array) <aqumsieh@matrox.com>
    Re: Newsfeed and Local Weather (Bart Lateur)
    Re: Newsfeed and Local Weather (Larry Rosler)
        Perl and Threads <melkor@utumno.student.utwente.nl>
    Re: Perl in the workplace <jbc@shell2.la.best.com>
    Re: Permutations (Bob Trieger)
        print buffer question <phnelson@u.washington.edu>
    Re: print buffer question (Andrew Johnson)
        Sample script to open a file w/ MacPerl? (Encrypted)
    Re: Sample script to open a file w/ MacPerl? <dgris@moiraine.dimensional.com>
        Search file, put accompanying line into variable <arm@home.net>
    Re: searching a file,matching first,putting remainder i <t-armbruster@ti.com>
        Segmentation fault on Apache with mod_perl dwang999@my-dejanews.com
        Simple question <netguy@homemail.com>
        suidperl <dsbryant@worldnet.att.net>
        Upload files <greynaga@yahoo.com>
    Re: which UNIX should I use? (Bob Trieger)
    Re: which UNIX should I use? (I R A Aggie)
        Windows NT Recursive Registry Keys <kimntodd@dontspamus.execpc.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 03 May 1999 17:27:05 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <372E22B9.BCD4051E@mindspring.com>

Eric The Read wrote:
> 
> tadmc@metronet.com (Tad McClellan) writes:
> >    Perl saved me from using lex and C to get the power of
> >    regular expressions.
> >
> >    I will be eternally grateful...
> 
> I still have to use regexes in C++ on occasion.  *gibber* *fear*
> 
> It's like swimming in frozen molasses.
> 
I tried struggling with implementing them in *Pascal*.  A Sisyphean
task, admittedly, but I found rolling a Perl much easier than a boulder,
or rolling my own, more to the point.  :-)


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

Date: 03 May 1999 15:54:22 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Filehandle Question
Message-Id: <xkflnf5lsz5.fsf@valdemar.col.hp.com>

"Steve Ball" <steve@berlingske.dk> writes:
> code summary:
> while (<>)
> $this_line=$_;
> 
>     open (H2H, "h2h.txt") || die "Error $!1\n";
> 
>     while (<H2H>){
>         ($a,$b)=split(' ');
>         ... play with $a and $b
>     }
> }
> 
> The idea being that the while(<>) goes through the HTML file test.html
> line-by-line, and replaces e.g. <B> by <BOLD> etc. - basically whatever
> conversions being in the h2h.txt, e.g.

<snip>

> My question was: must I have the open(H2H, "h2h.txt") in the while(<>) and
> not outside the while(<>)? Outside, seemed only to go through the H2H once.

It's only going to go through it once, because you're going to open the
file, which sets the file pointer to the start of the file, and then read 
until the end.  Once you've read to the end of the file, the only way to
get back to the start is to do a seek.

But even that's a pretty inefficient way to do it.  Why not slurp the
whole thing into a hash at the start, and then iterate over the keys of
the hash?

open (H2H, "h2h.txt") || die "ack! couldn't open h2h.txt: $!";
while(<H2H>)
{
  ($a, $b) = split;
  $hash{$a} = $b;
}

and then where you do your current loop through the test.html file:

s/keyword/$hash{keyword}/

or

s/(key1|key2|key3)/$hash{$1}/;

or even

$pattern = join '|', keys %hash;
1 while s/($pattern)/$hash{$1}/g;

I don't like that '1 while ...' syntax, but I can't remember right now
why it's a bad idea.  But it does work.

> Files attached if they help to explain?

Don't bother uuencoding them-- they're text to start with; uuencoding
them just makes them impossible to read.

-=Eric


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

Date: Mon, 3 May 1999 17:09:28 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Filehandle Question
Message-Id: <fcpX2.17$zh2.978@dfw-service1.ext.raytheon.com>


Steve Ball wrote in message <7gl3sp$8d1$1@holmes.dk.uu.net>...
>
>Tim Armbruster wrote in message
>
>I think that I have mis-explained my question: I'll have a second go at
>explaining.


OK, I think I've got it now.  I think you should use ARGV explicitly instead
of implicitly like:

open (H2H, "h2h.txt") || die "Error opening h2h. $!\n";
while (<H2H>){

 ($HTML,$Hermes)=split(' ');
 #store in an associative array

}
close(H2H);

open (HTMLFILE, $ARGV[0]) || die "Error opening $ARGV[0]. $!\n";
while (<HTMLFILE>){
    $this_line=$_;

 # compare $this_line to associative array and process

}
close(HTMLFILE);

Sorry if I misinterpreted again.  This works fine for me.






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

Date: Mon, 03 May 1999 21:10:21 GMT
From: Matthew Tillett <computertech@clara.net>
Subject: Fractional numbers..?
Message-Id: <372E10DF.21F40B02@clara.net>

Hi,

	Does anyone know of a simple way of returning the fractional part of a
number?  E.g.,  if x=2.34, how could I return the .34 part?

Any help is a great help..!

Regards,

Mat

e-mail: computertech@clara.net


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

Date: Mon, 03 May 1999 15:02:28 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Fractional numbers..?
Message-Id: <372E1CF4.F32DB05@mail.cor.epa.gov>

Matthew Tillett wrote:
> 
> Hi,
> 
>         Does anyone know of a simple way of returning the fractional part of a
> number?  E.g.,  if x=2.34, how could I return the .34 part?

First, `x' is not a legal Perl scalar.  You want $x.  Perl is picky
about
this, and so you should be too.  You might want to take a look in the
perldata pages if you don't feel comfortable with this.

You may not have found the appropriate FAQ, but there is an applicable
one.
Anytime you have a `numbers' question, you should think about the
`numbers'
section of perlfaq4.

You have two choices.  Use int() and subtract:
    $frac = $x - int($x);
or turn to the POSIX module:

use POSIX qw(modf);
($fracpart, $intpart) = POSIX::modf($x);

> Any help is a great help..!

Even the crabby help you get here?  :-)

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Mon, 3 May 1999 15:24:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Fractional numbers..?
Message-Id: <MPG.1197c217e1c648139899aa@nntp.hpl.hp.com>

In article <372E1CF4.F32DB05@mail.cor.epa.gov> on Mon, 03 May 1999 
15:02:28 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Matthew Tillett wrote:
 ...
> > Any help is a great help..!
> 
> Even the crabby help you get here?  :-)

As long as it's not
    tr/b/p/;
help.  :-)


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


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

Date: Mon, 03 May 1999 22:07:51 GMT
From: matt@matt.com
Subject: Grrr ... rsh refuses to work out of cron
Message-Id: <371b66cd.505212265@news.infonent.com>


I whipped up this great little script which rsh's a Cisco router, then
parses through the routing table to return valuable information about
our peers.

However, while it works from the command line, it refuses to work from
cron.

Here's a little example I whipped up to illustrate:

#!/usr/bin/perl -w

$SIG{INT} = \&nothing;
$SIG{KILL} = \&nothing;
$SIG{HUP} = \&nothing;
$SIG{CHLD} = \&nothing;
$| = 1;

open (FILE, "> output");

open (CMD, "rsh cisco-router show version |");

while (<CMD>)	{ print FILE $_; }

close (CMD);
close (FILE);

sub nothing {}

The resulting output is anywhere from 1 to 10 lines of the "show
version" command from the router.  Even though I'm ignoring all
signals and autoflushing, I can't get the whole command to come back.

I've also tried fork()ing, then rsh'ing, but no go.

Any help is greatly appreciated.

--matt hempel


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

Date: Mon, 03 May 1999 22:07:50 GMT
From: matt@matt.com
Subject: Grrrr .... rsh from cron refuses to work
Message-Id: <371b6596.504901734@news.infonent.com>


I wrote this cool script which uses rsh to parse through a Cisco
router's routing table and return valuable peering data.  It works
great from the command line, but refuses to work from cron.

Here's a little something I whipped up to illustrate:

#!/usr/bin/perl -w

$SIG{INT} = \&nothing;
$SIG{KILL} = \&nothing;
$SIG{HUP} = \&nothing;
$| = 1;

open (FILE, "> output");

open (CMD, "rsh cisco-router show version |");

while (<CMD>)	{ print FILE $_; }

close (CMD);
close (FILE);

sub nothing {}

What you get in the file output is anywhere from 1 to 15 lines of the
"show version" command, but never the entire thing.  And, of course,
it works from the command line.

Even with all these signals ignored and autoflush turned on, it aint
working.  I've also tried forking, then rshing, to no avail.

Any other ideas are greatly appreciated.

--matt hempel


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

Date: 3 May 1999 21:25:42 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How to get perl to get data via FTP and other TCP/IP protocols?
Message-Id: <slrn7is57k.be.fl_aggie@stat.fsu.edu>

On 3 May 1999 18:22:35 GMT, Perl Worthington <adsfjlk@fdk.org>, in
<7gkphb$8gv$2@agate.berkeley.edu> wrote:

+ Hello, If I wanted to catalogue files on servers, say FTP sites, then Perl
+ could get the data by issuing a shell command, since FTP is a standard UNIX
+ command.

Have you tried doing this? try it sometime. But if you don't want to
waste your time, try Net::FTP.
 
+ you use a mac/pc clien to access servers running on macos or windows. How
+ would figure out how to get unix/perl to emulate/recognize these kind of
+ protocols? Is this possible?

As long as you can open a socket (see 'perldoc Socket'), you can
send/receive a data stream from a server (or act as the server).

As to how to constitute that output, or parse the input, one would have
to know the format. Ideally, that information is readily available. If
not, you'll have to ask the vendor how to obtain the info...

James


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

Date: Mon, 03 May 1999 21:25:18 +0000
From: Aran Cox <acox@cv.telegroup.com>
To: icyt@my-dejanews.com
Subject: Re: How to implement array of structure in perl
Message-Id: <372E143E.5C1B582A@cv.telegroup.com>

icyt@my-dejanews.com wrote:

You can implement this as a hash of array references.

Initializing this in perl looks like this:

$data{'mary'}= [ 'female', 16 ];

Or as follows:

@somedata=( 'female', 16 );
@somedata= qw( female 16 ); # both are equiv

$data{'mary'}=\@somedata;

Getting the data back out again looks like this:

print "age of mary: ".$data{'mary'}[1]."\n";

Or you could do like this:

@retdata=@{$data{'mary'}};

print "sex: ".$retdata[0]." age: ".$retdata[1]."\n";

Really there are a million was to do this, you could make it a hash of
hash references and use this method instead:

$data{'mary'}{'age'}=16;
$data{'mary'}{'sex'}='female';

You really should read the perlref manpage.  It explains all this stuff
pretty well but the O'Reilly books probably cover it a little more
clearly.

The manpages, however are free.


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

Date: Mon, 3 May 1999 18:10:56 -0400
From: "Mike Flaherty" <mflaherty2@earthlink.net>
Subject: ISPs that offer cgi space??
Message-Id: <7gl6rs$9bt$1@birch.prod.itd.earthlink.net>

I haven't looked yet but this seems like to best place to start.

I am looking to start a web site for public use.  I know there are plenty
of ISPs that offer web space - even for free.  However, I want to use CGI
scripts and I will need access to a command line in order to develop/debug
them.  This is a non issue for the stuff I write at work but do commercial
ISPs allow that kind of access?

Sorry if this is a no brainer.

Thanks in Advance,
Mike Flaherty
Westwood, MA






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

Date: Mon, 03 May 1999 15:22:40 -0700
From: "Alex Black" <enigma@turingstudio.com>
Subject: looking at directories
Message-Id: <372e20a3$0$218@nntp1.ba.best.com>

hi everyone,

I've been looking around for info on how to access the filesystem with perl,
specifically I need to get the number of files in a directory.

haven't been able to find a thing :)

anyone out there have a url they can send me or a code snippet?

tia,

_a


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

Date: Mon, 03 May 1999 15:31:18 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: looking at directories
Message-Id: <372E23B6.EC3193D3@mail.cor.epa.gov>

Alex Black wrote:
> 
> hi everyone,
> 
> I've been looking around for info on how to access the filesystem with perl,
> specifically I need to get the number of files in a directory.
> 
> haven't been able to find a thing :)
> 
> anyone out there have a url they can send me or a code snippet?

Here's an easy way to get a code snippet, which even drops out the 
dirs prefaced by a dot, then collects all the names in an array for
you:

perldoc -f readdir

where you type this at a command prompt.
Then you'll want to take the hint offered there to read up
on the *dir functions in Perl.
 
> tia,

yw,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Mon, 03 May 1999 21:15:41 GMT
From: "markguy" <markg@jup.com>
Subject: Looking for clever way to swap file sections
Message-Id: <1moX2.3098$vY2.17331@c01read01.service.talkway.com>

H'lo folks,

I maintain a site that has two versions of similar pages... one for
members and the other for guests. There are some relatively simple
changes between the two and are fortunately fairly consistent. In fact,
only things like the nav bars and forms are different. The content
itself is almost always the same.

What I had done previously was use HTML comments to define a section,
read up the two pages and merely use a regexp to switch out the
sections (which were in a hash). This worked fine (if a little slow)
until I hit the memory limit on regexps; if you weren't aware of this,
a regexp that compiles to larger than 32767 bytes will go kablooie.
While this isn't a typical occurence, it obviously happened. 

Would some kind soul happen to have a solution or suggestion for this?
Updating both sides of the site is lengthening my day and raising the
number of errors introduced into the page. If more info is required,
please contact me off-list.

Thanks

markguy
--
Posted via Talkway - http://www.talkway.com
Exchange ideas on practically anything (tm).



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

Date: 03 May 1999 18:41:10 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Looking for clever way to swap file sections
Message-Id: <x7n1zl3hfd.fsf@home.sysarch.com>

>>>>> "m" == markguy  <markg@jup.com> writes:

  m> H'lo folks,
  m> I maintain a site that has two versions of similar pages... one for
  m> members and the other for guests. There are some relatively simple
  m> changes between the two and are fortunately fairly consistent. In fact,
  m> only things like the nav bars and forms are different. The content
  m> itself is almost always the same.

  m> What I had done previously was use HTML comments to define a section,
  m> read up the two pages and merely use a regexp to switch out the
  m> sections (which were in a hash). This worked fine (if a little slow)
  m> until I hit the memory limit on regexps; if you weren't aware of this,
  m> a regexp that compiles to larger than 32767 bytes will go kablooie.
  m> While this isn't a typical occurence, it obviously happened. 

  m> Would some kind soul happen to have a solution or suggestion for this?
  m> Updating both sides of the site is lengthening my day and raising the
  m> number of errors introduced into the page. If more info is required,
  m> please contact me off-list.

since you didn't post more info i will take a stab at what i see.

i don't know why you are using regexes for this. if the comment tags are
well defined, you can use index find them and substr to replace them
with themselves plus more text. that should be very simple and very
fast. in fact if the comment format is very well defined, the comment
text could be a key to a hash which is used to replace it. then a single
simple regex with a hash replacement part will work just fine.

here is some pseudo perl code (very untested and my comment html is
probably wrong but who cares):

%member_parts = (

	'form'		=> <<FORM,
lots of form blah
FORM
	'navbar'	=> <<NAVBAR
lots of navbar blah
NAVBAR

) ;

same for user hash!


then just do this:

	$page =~ s/<<-(\w+?)>/<<-$1>$member_parts{$1}/g ;

same for users.

hth,

uri





-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 3 May 1999 16:13:49 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Newbie in need (reading a file into an array)
Message-Id: <x3yyaj5nc77.fsf@tigre.matrox.com>


"Matt G. Ellis" <mgeusenet@usa.net> writes:

> Okay i have a file, i want to be able to read all the lines into one big
> array so i can refrence it in my script.
> 
> So $arrayname[0] would be line one and $arrayname[1] world be line 2 and so
> on?

Ok .. sounds pretty simple. What is it that you're having troubles
with? Show us some code that you think should exhibit the above
behaviour, but doesn't, and someone will help you refine it.



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

Date: Mon, 03 May 1999 21:11:44 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Newsfeed and Local Weather
Message-Id: <372e10d0.2008442@news.skynet.be>

Larry Rosler wrote:

>nobodyuses&nbsp;&nbsp;toseparate
>sentencesinanycasebuttheyshould

No they shouldn't. Or do you think that wrapping whould only occur
between words of the same sentence, and not between two sentences?

	Bart.


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

Date: Mon, 3 May 1999 14:22:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newsfeed and Local Weather
Message-Id: <MPG.1197b37f5fefa95d9899a9@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <Pine.HPP.3.95a.990503210129.14031R-100000@hpplus01.cern.ch> 
on Mon, 3 May 1999 21:05:34 +0200, Alan J. Flavell 
<flavell@mail.cern.ch> says...
> On Mon, 3 May 1999, Larry Rosler wrote:
> > theadventofHTMLhasmadeitevenworsebecauseinordinarytextHTMLtreatstwospace
> > sthesameasonesonooneseesthedistictionandnobodyuses&nbsp;&nbsp;toseparate
> > sentencesinanycasebuttheyshould!
> 
> Sorry, can't agree with that.  Joking aside: the SGML/HTML way would be
> to wrap sentences in a pair of opening/closing sentence tags.  Whether
> the rendering involved two spaces or not would be entirely a
> presentation issue.  Remember, some renderings aren't visual anyway. 

Well, we've drifted far from Perl, but please answer anyway.

I've never heard of a sentence tag in HTML.  The HTML 3.2 Reference 
Specification <URL:http://www.w3.org/TR/WD-html32> and the the HTML 4.0 
Reference Specification <URL:http://www.w3.org/TR/REC-html40/> and 
<URL:http://www.w3.org/TR/REC-html40/index/elements.html> don't even 
contain the word 'sentence'.

What HTML tage were you referring to?

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


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

Date: 3 May 1999 21:51:44 GMT
From: Thomas van Gulick <melkor@utumno.student.utwente.nl>
Subject: Perl and Threads
Message-Id: <7gl5pg$bcb$1@dinkel.civ.utwente.nl>

I'm a bit confused, but do I have to compile a 'threaded Perl' to be able to
use the Thread package of Perl, or does 'thread Pearl' just mean Perl uses
thread internally?

I ask this because I fail to compile Apache with mod_perl when Perl is
'threaded'. It segfault on loading mod_perl. I'd like to use a non 'threaded
Perl' but I'm not sure whether I can 'use Thread's :)

Thomas
-- 
http://utumno/~dance/                           Dance CAMPUSnet
http://utumno.student.utwente.nl/~calve/        Calslaan 40
http://utumno.student.utwente.nl/~melkor/       Personal
melkor@utumno.student.utwente.nl


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

Date: 03 May 1999 21:47:49 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Perl in the workplace
Message-Id: <372e1985$0$214@nntp1.ba.best.com>

sstarre@my-dejanews.com wrote:

> Do others find this kind of resistance to Perl at work? If so, were you able
> to make a case to management to at least allow it as a "2nd language"? Have
> you had to "go underground" to get your job done?

A really good resource (which you may well have seen already) is the
Perl Advocacy page at:

http://www.perl.org/advocacy/tech.html

-- 
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Mon, 03 May 1999 21:37:37 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Permutations
Message-Id: <7gl47d$fic$1@fir.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
Kenneth Rose <kenrose@home.com> wrote:
>Hi all,
>
>OK, have an interesting question.  I've searched desperately for
>something like this in Perl.  A permutation library.  Basically, I'm
>looking for something like:

Gee, you must have searched everywhere but PerlFAQ4

How do I permute N elements of a list? 

HTH



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

Date: Mon, 3 May 1999 15:02:51 -0700
From: "N. Phouphakone" <phnelson@u.washington.edu>
Subject: print buffer question
Message-Id: <Pine.A41.4.10.9905031447450.74894-100000@dante21.u.washington.edu>

Hi,

I got a problem when use print as follow, 

  print "test this";
  sleep 10;
  print "\n";

The problem is the "test this" message will not print to the STDOUT until
the "\n" is write to the buffer.  Is anyone know how to flush the buffer?
Like a "flush" command in C.

Thanks,



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

Date: Mon, 03 May 1999 22:14:08 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: print buffer question
Message-Id: <QcpX2.9268$Ss1.1517054@news1.rdc1.on.wave.home.com>

In article <Pine.A41.4.10.9905031447450.74894-100000@dante21.u.washington.edu>,
 N. Phouphakone <phnelson@u.washington.edu> wrote:
!  Hi,
!  
!  I got a problem when use print as follow, 
!  
!    print "test this";
!    sleep 10;
!    print "\n";
!  
!  The problem is the "test this" message will not print to the STDOUT
!  until the "\n" is write to the buffer.  Is anyone know how to flush
!  the buffer? Like a "flush" command in C.

search the FAQ's for flush ...
 
perlfaq5.pod: How do I flush/unbuffer an output filehandle?  
              Why must I do this?

regards
andrew


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

Date: Mon, 03 May 1999 18:16:33 -0400
From: encrypted@junk.mail.unwanted (Encrypted)
Subject: Sample script to open a file w/ MacPerl?
Message-Id: <encrypted-0305991816330001@dialup-717.hip.cam.org>

   It'll be greatly appreciated.

   TIA

-- 
Mail: hbae at cam dot org

Web: www dot cam dot org slash tilde hbae

Hit any key to quit, any other key to continue.


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

Date: 03 May 1999 16:48:18 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Sample script to open a file w/ MacPerl?
Message-Id: <m3u2ttkbwt.fsf@moiraine.dimensional.com>

idiot-boy with a munged address writes:

> Mail: hbae at cam dot org
> 
> Web: www dot cam dot org slash tilde hbae

As if it isn't bad enough that people try to munge their
mail addresses--now they're trying to munge their web
addresses as well.  Like that does anything, sheesh.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Mon, 03 May 1999 21:38:55 GMT
From: Alan Melton <arm@home.net>
Subject: Search file, put accompanying line into variable
Message-Id: <372E1752.4471616B@home.net>

I wrote an html to ask for a number to search by;
want to look through this list with a perl program.

"0092335","CHM 015","PSY 010","EGL 033","",""
"0144990","PSY 010N","GEO 010","MTH 017","CER 012",""
"1066370","GMI 210","HSS 200","GMI 250","GMI 020",""
"1017644","CHM 012","BIO 024","CLS 021","",""
"0102273","CER 128","CER 151","CER 152","GEO 014",""
"1083733","FPR 010","PSY 010","PHL 014","",""
"1085736","FPR 010","PSY 010","SPN 121","",""
"0167708","PSY 047","ANT 012","IDM 199","",""
"1091081","ECO 042","PSY 010","ECO 032","",""
"1171201","BIO 010","MTH 010","HST 013","",""
"1282705","HST 035","MTH 011A","ESC 016","EIS 001",""
"0088916","HST 009","MTH 012","HST 014","",""

If the number matches the first field, I only want to put
the other fields into a variable that are on the same line as the
number.
What should be the delimiter for the fields since they aren't just
separated by a : or , . I have all the perl books and can do conversions
on fixed length files but do not know how to pull  out the fields on a
comma delimited file in perl.

Thanks
Alan Melton


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

Date: Mon, 3 May 1999 16:21:09 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: searching a file,matching first,putting remainder into variables
Message-Id: <XuoX2.16$zh2.1063@dfw-service1.ext.raytheon.com>

Perl isn't even mentioned or hinted at in this post.  More than that, it
seems like you're trying to get someone to write a program for you so you
don't have to.  Pick up a book.  No one here has time to do your work for
you.

Alan Melton wrote in message <372E1227.1D5D32B5@home.net>...
>An html asks for a number to search by;
>want to look through this list





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

Date: Mon, 03 May 1999 22:23:02 GMT
From: dwang999@my-dejanews.com
Subject: Segmentation fault on Apache with mod_perl
Message-Id: <7gl7k1$pnn$1@nnrp1.dejanews.com>

I have Apache 1.3.9 and mod_perl 1.1.9 on BSD/OS. When try to make a
connection to the Mysql database, the Apache child process died with the
following error message:

child pid 2756 exit signal Segmentation fault (11) Also, Mysql database did
not seem to receive the connection, because the log of Mysql did not show any
connections established.

I can make connections to the database outside of Apache without using
mod_perl.

Any suggestions are welcomed.

-Dong

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


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

Date: Mon, 03 May 1999 22:40:40 GMT
From: Netguy <netguy@homemail.com>
Subject: Simple question
Message-Id: <7gl8l9$qnb$1@nnrp1.dejanews.com>

How to get something like LWP::Simple get() or like that work in
(uh) Windows95?

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


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

Date: Mon, 3 May 1999 17:56:27 -0400
From: "Don Bryant" <dsbryant@worldnet.att.net>
Subject: suidperl
Message-Id: <7gl5vj$or3$1@bgtnsc03.worldnet.att.net>

Could someone briefly explain the purpose and use of suidperl?

Thanks,

Don Bryant




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

Date: Mon, 03 May 1999 22:05:34 GMT
From: Gerardo <greynaga@yahoo.com>
Subject: Upload files
Message-Id: <7gl6jc$opa$1@nnrp1.dejanews.com>

Hello,

I'm working on a web page that uploads a file to the server. I've downloaded
"Jeff Scripts" to upload a file. I've read the README file and setup
evertything as indicated. When I load (netscape 4.07) the upload.html
included with the files I get "Premature end of script headers".

I read about this message and I think file-upload.cgi takes care of the
problem by flushing Perl's buffer. $| = 1;

I changed the path to the right location of my Perl interpreter (ver 5.005)
in file-upload.cgi. I changed permissions - 755 - to that script. I've tried
to run the script manually './file-upload.cgi' but I get command not found; I
do watch for case sensitiveness. On the other hand I have another script with
same permissions, owner and group which runs fine.

It could be that it has something to do with my server configuration, because
I've read in previous messages posted here that people is running the script.
I know it's hard to tell from this description if it's server config. But can
you give me some hints on what to look for.

Thank you in advance
Gerardo

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


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

Date: Mon, 03 May 1999 21:45:43 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: which UNIX should I use?
Message-Id: <7gl4mj$fic$2@fir.prod.itd.earthlink.net>

bogart@exis.no.spam.net wrote:
>Hi,
>
>I have an old 586/150 box at home (1.4 GHD, 32M Ram) that I want to set up to
>run Perl. I am now using An SGI 02 running Irix 6.5 and Apache at work and
> would
>like to build and environment that is not too dissimilar for home. I am even
>willing to _spend_ $$ for the os (especially now that RedHat Linux can be had
>for only $40.) So, what would be the best choice of UNIX flavors that would run
>on my box?

Your answer can be found in the FAQs, unfortunately not the perl faqs 
because this has nothing to do with perl.

This is a perl newsgroup. Not Unix or even UNIX.



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

Date: 3 May 1999 21:42:17 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: which UNIX should I use?
Message-Id: <slrn7is66m.be.fl_aggie@stat.fsu.edu>

On Mon, 03 May 1999 14:33:56 -0500, Ed Bogart <bogart@exis.no.spam.net>, in
<372DFA24.632FF99E@exis.no.spam.net> wrote:

[bunch o' stuff chop()'d]

Off-topic -- what does it have to do with perl? -- and I would have
given an answer in email, but I'm too lazy to demunge your spam block...

IMHO, you want linux. Which version is up to your personal tastes.

James - I like debian, but started with RH...


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

Date: Mon, 3 May 1999 15:46:33 -0500
From: "End User" <kimntodd@dontspamus.execpc.com>
Subject: Windows NT Recursive Registry Keys
Message-Id: <7gl2f7$f11$1@ffx2nh3.news.uu.net>

Quite simply, does anyone have the code that opens a registry key, and
enumerates all the subkeys (not values) to that key?

Thanks,
--
Todd Hayward
Global Analyst, Systems Engineer
MCSE, Compaq ACT
noc at bakernet dot com




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

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

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