[8471] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2088 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 13 08:07:57 1998

Date: Fri, 13 Mar 98 05:00:47 -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           Fri, 13 Mar 1998     Volume: 8 Number: 2088

Today's topics:
    Re: Are There Any Snazzy Perl Editors for Windows? (Koos Pol)
    Re: c.l.p.mod and TPI <dformosa@st.nepean.uws.edu.au>
        find a word <frankie@etsetb.upc.es>
        got a problem... <shockman@telefragged.com>
    Re: got a problem... <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: got a problem... <orjana@acm.org>
    Re: Graphical menus in Perl? <lovegod@earthling.net>
        Help: Better way to retrieve the configuration file? <tkho@technologist.com>
    Re: How to read whole HTML content from Web pages? (Philippe  Bouige)
        HTTP Perl Works local? jcamp@plexi.com
    Re: m//x punctuation + comment oddity <r.goeggel@atos-group.de>
    Re: New problem .... (Bart Lateur)
    Re: New problem .... <ebohlman@netcom.com>
        Perl For Windows NT <huskystudio@geocities.com>
    Re: Printing Hash of Hashes Problem <ebohlman@netcom.com>
    Re: Printing Hash of Hashes Problem <ewinter@pop3.stx.com>
    Re: Problem with "goto" in Perl (Tony Fitzgerald)
    Re: Q: "Use Warnings" - semantics/usage are? (Paul Marquess)
    Re: Speed of sort routine vs. one-by-one compare   (123 (Matija Grabnar)
    Re: system("ed <stuff>") dennis_marti@yahoo.com
    Re: What is PERL? Learn JAVA instead? <lovegod@earthling.net>
        What? <lovegod@earthling.net>
    Re: Where can I find a ping script written in perl (Jeffrey R. Drumm)
    Re: You have 1 message(s) - how to print plurals? (Bart Lateur)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 13 Mar 1998 07:49:43 GMT
From: koos@stag (Koos Pol)
Subject: Re: Are There Any Snazzy Perl Editors for Windows?
Message-Id: <6eaoen$2t2@news.nl.compuware.com>

Keith Turner (rkturner@us.ibm.com) wrote:
| Are there any text editors for windows  that can recognize perl syntax and
| color code and such?


Nobody seems to mention FTE from Marko Macek!
Very fast, auto indenting, color syntax highlighting for Perl, C,
Pascal, Shell, Ada, (etc.) there iss a port for DOS, OS/2, Win32, Unix
AND IT'S FREE !!!

--
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
Systems Administrator                      email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: 13 Mar 1998 10:54:43 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: c.l.p.mod and TPI
Message-Id: <889786483.242100@cabal>

In <3507C00F.7DE1@aspentech.com> Ian Boys <boys@aspentech.com> writes:

[...]

>Actually, her correct title is HM the Queen;

I stand corrected sorry about that.

>  However, you may be a republican, and so may not care all that much.

While I am a republican [1] years of programing have rendered me
highly respectfull of protocol.

[1] For 'merkins out there republican in this context means one who wishes
to remove a monarky and establish a republic, it has little to do the with
party of the same name.
--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. 
Support NoCeM http://www.cm.org/                   
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: Fri, 13 Mar 1998 13:00:03 +0100
From: Francesc Guasch <frankie@etsetb.upc.es>
Subject: find a word
Message-Id: <35091FC2.E7DBC8F3@etsetb.upc.es>

Hi. I've been doing perl thingies for a short time
Now I'm trying some regexp. I got the camel but the
explanations I found are too short for me.

I'd appreaciate if someone could give me an example
of how to find the first word in a string.

Someone gives me $a="blah     "
			spaces

I want $b="blah" but I've been playing with \W and \w
unsuccessfully and I'm driving myself crazy 'cause I
see it must be EASY

I tried many many things ...
why didn't that worked ?

$_="blah  ";
$b=~ /(\W)/g

-- 
 ^-^.-----,             mailto:frankie@etsetb.upc.es
 o o _     )            http://www.etsetb.upc.es/~frankie
  Y (_, (__(Ssss


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

Date: Fri, 13 Mar 1998 11:54:40 +0100
From: "Magnus \"ShockMan\" Blikstad" <shockman@telefragged.com>
Subject: got a problem...
Message-Id: <35091070.21298C1E@telefragged.com>

Hi,

i have been working with perl now for some time to write simple cgi
scripts, and now i got a small problem. So far all input to my scripts
have been coming from HTML forms. but now im creating a script to handle
a combined database and search engine and i need to get the input from
the url... i know that you can pass input to scripts by adding a ? after
the script in the url and then add what ever you want after that. but
how do i read it!? to read from forms i use read(STDIN, $buffer,
ENV{'CONTENT_LENGHT'}; and then split up the variables with the split
command. well... hope someone can help me with this. please email me
since i dont have time to check newsgroups to often...

Thanx

-Magnus Blikstad



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

Date: 13 Mar 1998 12:34:37 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: got a problem...
Message-Id: <7x67liakoi.fsf@beavis.vcpc.univie.ac.at>

Re: got a problem..., Magnus <Magnus> said:

Magnus> problem. So far all input to my scripts have been
Magnus> coming from HTML forms. but now im creating a script
Magnus> to handle a combined database and search engine and
Magnus> i need to get the input from the url... i know that
Magnus> you can pass input to scripts by adding a ? after
Magnus> the script in the url and then add what ever you
Magnus> want after that. but how do i read it!?

use CGI;

hth
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"


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

Date: 13 Mar 1998 13:07:36 +0100
From: Oerjan Nygaard Austvold <orjana@acm.org>
Subject: Re: got a problem...
Message-Id: <soom7q0n.fsf@localhost.localdomain>

You should probably read some more on the HTTP protocol!

When data is passed to the CGI-script in an URL-encoded form (HEAD or
GET method), it means that the server delivers the data to the script
through an enviroment variable ( $ENV{QUERY_STRING} ) instead of STDIN.

Take a look at the HTTP 1.0 and 1.1 protocols at
	<URL:http://www.w3.org/Protocols/rfc1945/rfc1945>
	<URL:http://www.w3.org/Protocols/rfc2068/rfc2068>

Followup is set to comp.infosystems.www.authoring.cgi.

-Oerjan.

"Magnus \"ShockMan\" Blikstad" <shockman@telefragged.com> writes:

> Hi,
> 
> i have been working with perl now for some time to write simple cgi
> scripts, and now i got a small problem. So far all input to my scripts
> have been coming from HTML forms. but now im creating a script to handle
> a combined database and search engine and i need to get the input from
> the url... i know that you can pass input to scripts by adding a ? after
> the script in the url and then add what ever you want after that. but
> how do i read it!? to read from forms i use read(STDIN, $buffer,
> ENV{'CONTENT_LENGHT'}; and then split up the variables with the split
> command. well... hope someone can help me with this. please email me
> since i dont have time to check newsgroups to often...
> 
> Thanx
> 
> -Magnus Blikstad
> 

-- 
Oerjan Nygaard Austvold    __________ Signature __________
Dept. of Computer Science /   tel/fax: +47 776 44571/44580
University of Tromsoe    /           mailto:orjana@acm.org 
N-9037 Tromsoe, Norway  / http://hstud3.cs.uit.no/~orjana/


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

Date: Fri, 13 Mar 1998 05:58:16 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: Re: Graphical menus in Perl?
Message-Id: <35091F58.4271@earthling.net>

> elsif ($dat == -69) { $bla="FIFTH_ENMENDMENT"; } #Why this don't work?

Because there is no such thing as a "Fifth Emendment". It's 
the Fifth Amendment. ("A", not "E").

Rich Grise (I can not be compelled to give testimony which would
put me in risk of prosecution).


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

Date: Fri, 13 Mar 1998 00:15:02 -0800
From: Tommy <tkho@technologist.com>
Subject: Help: Better way to retrieve the configuration file?
Message-Id: <3508EB06.E5086E4C@technologist.com>

I have a question on how to use configuration file for several perl
scripts.

For example, in a basic program file, test.pl:

  #!/usr/bin/perl -w
  my $SETTINGS= "CONFIGURATION";
  print $SETTINGS, "\n";
  __END__


What is the better way to separate the configuration line? i.e for
config.cfg

  #!/usr/bin/perl -w
  my $SETTINGS= "CONFIGURATION";
  __END__

and test.pl

  #!/usr/bin/perl -w
  open(CONFIG, "config.cfg") || die print "Error!\n";
  while (<CONFIG>) {
    chomp;
    s/^\s+//g; # kill whitespace
    eval $_;
  }
  print $SETTINGS, "\n";
  __END__

Can I use "use" or "require"? Can I not put the file in the @INC?

-- 
Tommy Ho
Email: tkho@technologist.com


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

Date: 13 Mar 1998 10:51:50 GMT
From: pbouige@pasteur.fr (Philippe  Bouige)
Subject: Re: How to read whole HTML content from Web pages?
Message-Id: <6eb346$vb2$1@montespan.pasteur.fr>

Elf Sternberg (elf@halcyon.com) wrote:
: In article <3507fe4a.7748986@news.cedep.com> 
:     gstamant@cedep.com (Guy St-Amant) writes:

: >I would like my script to read the content of various Web pages.
: >How can I do that?

Try url_get

--
          ____________________________________________________________
         / Philipe Bouige Tel : 40 61 31 68 labo. des sondes froides /\
        | mail : pbouige@pasteur.fr                                 |_/
        | http://www.mygale.org/02/moyo                             |
     ___|________________________________________________________   |
     \___________________________________________________________\__/


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

Date: Fri, 13 Mar 1998 01:59:37 -0600
From: jcamp@plexi.com
Subject: HTTP Perl Works local?
Message-Id: <6eaoue$t30$1@nnrp1.dejanews.com>

When I run this script locally, it works fine on NT4.0, but when I run it with
the web browser, even from the local machine, it doesn't work! I've gone over
all of the directory permissions, so I know that's not it.  All it does is
grab the web page at http://www.plexi.com/index.html and writes it to a file.
 Perl creates the file, but doesn't output the $buf.  I'm new to Perl, so I'd
appreciate it if you could help me out.  Thanks, here's the script I'm trying
to run:

require "c:/web/plexi/cgi-bin/cgi-lib.pl";
require "c:/web/plexi/cgi-bin/http-lib.pl";
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";

$buf = &HTTPGet("/index.html", "www.plexi.com", 80,"");
$file_tmp = "c:/web/plexi/cgi-bin/test.txt";
open (TMP_FILE,">$file_tmp") || print("File Problem!");

print TMP_FILE $buf;

close TMP_FILE;

Jason Camp
Plexi Communications

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


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

Date: Fri, 13 Mar 1998 11:58:38 +0100
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: m//x punctuation + comment oddity
Message-Id: <6eb3i4$ps$1@news.pop-stuttgart.de>


jnutting@rebisoft.com writes <6e65fn$e86$1@nnrp1.dejanews.com>...
>Here's something odd.  With the following program:
>
>$testString = "bill=evil";
>if ($testString =~
>  /\w+  # bill comment
>  =
>  \w+   # evil comment
>  /x) { print "case 1: Matched the =.\n"};
>if ($testString =~
>  /\w+  # bill comment
>  =     # comment of death
>  \w+   # evil comment
>  /x) { print "case 2: Matched the =.\n"};
>I get this output:
>
>1: Matched the =.
>
>when I would expect it to output the third line as well.  The only
difference
>between case 1 & 2 is the absence/presence of the "# comment of death".
<snip>
>Any ideas why this happens?  I'm running 5.001m on OpenStep 4.2
>

Hi Jack
I'm running 5.004 and had no problems. Both cases work well.

But I had problems in cat&paste because there are some \240 includes and so
the search didn't match. I replaced them by Blanks and both Cases matched.

HTH
Ronald





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

Date: Fri, 13 Mar 1998 08:57:12 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: New problem ....
Message-Id: <350cef1e.3721553@news.tornado.be>

"Ben" <ben@wallroyds.demon.co.uk> wrote:

>Can't find string terminator "end_of_html" anywhere before EOF at id2.cgi
>line 3

>print <<"end_of_html";
 ...
>end_of_html

This is a well known pitfall. This usually means that there are some
invisible characters (maybe spaces) on your end_of_html line. This could
even be some invisible control characters. Note that the end delimiter
should be on a line of it's own, with NOTHING else there.

Simply retyping the final "end_of_html" line should work. It usually
does for me.

HTH,
Bart.


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

Date: Fri, 13 Mar 1998 09:42:13 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: New problem ....
Message-Id: <ebohlmanEpr4AD.KH0@netcom.com>

Ben <ben@wallroyds.demon.co.uk> wrote:
: The print stuff problem has solved ... But this one can't be solved by
: myself ....

: Can't find string terminator "end_of_html" anywhere before EOF at id2.cgi
: line 3

Is it possible that you edited the script on a Windows system and then 
ftp'd it to a Unix server in binary mode?  If so, there's an invisible 
control-M character on the end of each line, including the terminating 
line, and that's preventing perl from recognizing the terminator.  If so, 
resend the script in ASCII mode, which fixes line-ending differences 
between platforms.



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

Date: Fri, 13 Mar 1998 17:26:43 +0800
From: "Husky" <huskystudio@geocities.com>
Subject: Perl For Windows NT
Message-Id: <6eatug$9sn@news.microsoft.com>

This is my first time to try to use Perl on Windows NT platform.
But when I use browser to see the result, it shows:
    HTTP/1.0 501 Not Support

I write down my step and hope you can help me...

1. launch Pw32i315.exe (1,510 KB) (Perl for Win32 Intel/x86 binary) and
install Perl on my NT 4.0 successfully.
2. Prepare a HTML in my web (d:\InetPub\wwwroot) like this:

<form method="POST" action="http://husky/cgi-bin/comments.pl">
  <p>Please :<input type="text" name="address" size="20"></p>
  <p>Your Comments:</p>
  <p><textarea rows="5" name="comments" cols="20" </textarea></p>
  <p><input type="submit" value="Submit" name="B1">
    <input type="reset" value="Reset" name="B2"</p>
</form>

3. Prepare a PL file named comments.pl in (D:\InetPub\wwwroot\cgi-bin) and
jsut print something:

print <"EndOfMessage";
<html>
<head>
<title>This is a test </title>
</head>
<body>
 <h1>Hi</h1>
</body>
</html>
EndOfMessage

4. Browser HTML and click the Submit button.

Is there any steps I lost something?
Please do me a favor...

Thanks
Andrew Wang




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

Date: Fri, 13 Mar 1998 09:26:15 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Printing Hash of Hashes Problem
Message-Id: <ebohlmanEpr3Jr.JBz@netcom.com>

Tom Lynch <toml@synnet.com> wrote:
:         I have a script which prints out expiring entries
:         in a flexlm license file. I'm getting different
:         results in different windows. It's built as a hash
:         of hashes:

: $matrix = [$_, $file, $result];
: push (@{$file_index{$file}}, $matrix);

If I read this right, file_index as a hash, each of whose entries is a 
reference to an array of references to three-element arrays.  IOW, each 
element of file_index is effectively an N x 3 array. 

:         How I print it is like so:

: foreach $i (sort keys %file_index) {
:   foreach $rl (sort @{$file_index{$i}}) {

It looks like you're trying to sort the rows of the appropriate N x 3 
array, but the rows aren't scalars themselves, they're references to 
3-element arrays.  It sounds like you need to specify a comparison block 
in your invocation of sort() so that it will know what to compare; I 
suspect that what it's doing now is 'stringifying' the references and 
sorting on that.


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

Date: Fri, 13 Mar 1998 06:37:32 -0500
From: "Eric Winter" <ewinter@pop3.stx.com>
Subject: Re: Printing Hash of Hashes Problem
Message-Id: <6eb5ri$gad@post.gsfc.nasa.gov>

Tom,

    I think the second "sort" is messing you up - you're then sorting the
contents of the array of references:

Tom Lynch wrote in message <35055E7D.23DC222A@synnet.com>...
<snip>
>$matrix = [$_, $file, $result];
>push (@{$file_index{$file}}, $matrix);

You just pushed an array ref into an array in a hash.

<SNIP>

>foreach $i (sort keys %file_index) {


For each key in the file_index hash, i.e. sorted filenames...

>  foreach $rl (sort @{$file_index{$i}}) {


    ... then for each item in the array referenced by the filename, i.e.
sorted contents of the list of references...

    So you're printing them out in the sort order of the value of their
references, like you'd get if you printed the values of the references
themselves, not the value of their expiration times. You could do something
like this instead (I think) to sort by the third field, since you can create
sort methods on the fly:

    foreach $rl (sort {$$a[2] <=> $$b[2]} @{$file_index{$i}}) {

 ...

HTH
Eric Winter
Raytheon STX




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

Date: 11 Mar 1998 22:04:37 -0400
From: jaf@sarastro.unb.ca (Tony Fitzgerald)
Subject: Re: Problem with "goto" in Perl
Message-Id: <6e7frl$rga@sarastro.unb.ca>

In article <3506A8A1.A2A@min.net>, John Porter  <jdporter@min.net> wrote:
>Somehow that doesn't strike me as simpler, clearer, and easier to
>maintain
>than:
 ...
>	  open F,$whatever or carp  "open $whatever: $!", goto KEEP_GOING;
>	KEEP_GOING:

Not included in the original code snippet and the reason for having a
Fail subroutine rather than generating the message and goto in open code
was that in real life situations, the Fail routine does things like
check if the HTTP header lines have been generated and issues something
like:

  print $cgi-> header, "<HTML><HEAD>.etc....<BODY>\n" unless $header++;

I don't think you want to include that every possible place you might
want to issue a diagnostic message.  The Fail routine also has suitable
"don't panic" type stuff about whom to contact if the problem persists
and whatnot.

>Not to mention:
 ...
>	  close F; # fails silently if not open.

Which is OK if all the clean-up and recovery code is safe to run if the
corresponding setup and initialization code was bypassed because of an
earlier error.  True, close is safe in such contexts but other
operations may not be and then you get into logic switches that have to
be set when the initialization is complete and tests wherever.

Taken to extremes, I've seen very convoluted code written as far as I
could tell only to avoid one or two goto's.  If a goto can simplify the
code then it is appropriate in the context.  Yes, I can write code
without ever using a goto and there was a period of about five years
when I took great pride in doing so, however, I now will no longer
unnecessarily complicate code to do so.  Most of my scripts have no
gotos because I generally can write simple effective code without them,
however, I don't consider my soul to be in danger of damnation if I slip
a goto into error recovery code that is only ever executed under test
conditions.
-- 
O- J. Anthony Fitzgerald, jaf@UNB.ca, http://www.unb.ca/csd/staff/jaf/ -O


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

Date: 13 Mar 1998 09:38:00 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: Q: "Use Warnings" - semantics/usage are?
Message-Id: <6eaupo$i6n$1@pheidippides.axion.bt.co.uk>

[ Posted & Mailed ]

Joseph R. Justice (jrj@access.this-is.a-false.address) wrote:

[ snip ]

: So, anyway, I was thinking about how to write up such an idea post and
: insert it into the current long -w flame thread, when I saw a post
: (which I now cannot find in my news spool) about something I assume is
: a module being discussed or that was discussed on the p5p list (which
: I do not get) called something like "Use Warnings".  And, from the
: context of the post, it seemed like this module would or could do some
: or all of the things I speculate on above.

: I found this of interest, so I tried finding the pertinent posts in
: the Web-accessible p5p archives, as linked to by www.perl.com.
: Unfortunately, the archive set I found, as accessed by the available
: search engine (Glimpse), gave me far too many hits to be able to
: reasonably skim through (IMHO).  I see nothing about this in the
: current Perl FAQ document.

: So, would anyone be willing to, I guess, summarize what the general
: semantics, usage, etc of this module, as discussed on p5p, might be?
: 'Cause, I can well see that, while I *like* compiling and/or running
: programs I write with all the warnings I can turn on, and I *like*
: being as strict in my usage (e.g. "use strict") as I can be, etc etc
: etc, I can see times when I *might* want to ignore certain warnings or
: classes or levels of warnings while still generally running under -w,
: and I wonder if this module, Use Warnings, might allow for that.

: Any information would be appreciated.

Check out the lexical warnings patch on CPAN. The file README.warnings
should tell you everything you want.

The patch is in

    $CPAN/authors/id/PMQS/warn.patch-5.004_56.gz

Paul


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

Date: 13 Mar 1998 11:46:04 GMT
From: matija@rzenik.arnes.si (Matija Grabnar)
Subject: Re: Speed of sort routine vs. one-by-one compare   (123)
Message-Id: <6eb69s$50j$1@kanja.arnes.si>

In article <6e93in$j0f2@eccws1.dearborn.ford.com>,
Ken Fox <kfox@pt0204.pto.ford.com> wrote:
>This feature is rather unique to Berkeley DB.  Most (all?) of the
>other dbm implementations use hashes which won't be ordered. 
I know Berkeley DB is the only one to support the sorted hash.
Which is exactly why I specified DB_File instead of Any_DBM.

> An
>index isn't the same as a sort, but *some* indexes also happen to be
>sorted. ;)

That's right, it isn't. But it looks like it would solve his problems...

-- 
"My name is Not Important. Not to friends. 
    But you can call me mr. Important"  - Not J. Important 
Matija.Grabnar@arnes.si


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

Date: Fri, 13 Mar 1998 02:06:20 -0600
From: dennis_marti@yahoo.com
Subject: Re: system("ed <stuff>")
Message-Id: <6eapb1$t7o$1@nnrp1.dejanews.com>

In article <3508374A.11CB@angelfire.com>,
  eglamkowski@angelfire.com wrote:

> Anyway, I've got this ed script I created using diff -e and I need
> to run this ed script on a dozen other files.  Since the script is
> so large as to be unpractical to rewrite for sed by hand, and I am not
> aware of any way to get sed scripts out of diff or of any ed2sed
> utilties or even any ed2perl utilities, I am stuck dealing with the ed
> script itself.

There are a couple of ways to deal with the diff output. The one I'd probably
use is another Larry Wall program called patch. It handles ed scripts as well
as other diff formats.

> So, I wrote this little perl program:
> foreach $file (<*.e>) {
>   system ("ed -s $file <diff.ed >$file.out");
> }

>From perl, something like this will work if you have a diff for each file

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

  $file = "report.2";

  open DIFF, "diff.ed"       or die "opening diff: $!";
  open ED, "| ed -s $file";

  print ED while <DIFF>;
  print ED "w $file.$$\n";   # writes $file.PID
  print ED "q\n";            # quits ed

  close ED;                  die "ed failed\n" if $?;


Dennis

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


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

Date: Fri, 13 Mar 1998 05:52:23 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <35091DF7.325F@earthling.net>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc,
>     gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
> :Per word.  As in: "Ja Va" => "Yes (using swedish) Go (using spanish)"
> :
> :I'm surprised none of the other English/Swedish/Spanish trilingual
> :readers of this group said anything.
> 
> Aber auf Deutsch sagt Mann la misma cosa (o sea, "ja") que dice en el
> Swedish, n'est-ce pas?  How se sabe si es aleman oder sueco dort?  :-)
> 
> --tom
> --
>         Tom Christiansen        tchrist@jhereg.perl.com
> 
>     if (instr(buf,sys_errlist[errno]))  /* you don't see this */
>         --Larry Wall in eval.c from the 4.0 perl source code


What's this? One Language per Word?

Maximize Available Opportunity!


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

Date: Fri, 13 Mar 1998 06:12:49 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: What?
Message-Id: <350922C1.1CD8@earthling.net>

What?


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

Date: Fri, 13 Mar 1998 12:44:45 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Where can I find a ping script written in perl
Message-Id: <35092451.2463191@news.mmc.org>

On Fri, 13 Mar 1998 10:21:11 +0800, Long Xue <long@gb.com.cn> wrote:

> Content-Type: multipart/alternative; boundary="------------B9D7E4FF2DBB96F4E6B873E4"

Please don't use MIME, and especially HTML in news postings. Fix your
newsreader so that it posts plain text.

>I'm trying to write a script to ping some sites( IP addresses of these
>sites taken from a data file). Now I use "system" function to do it. It
>just like this:
>    system("ping $ip");
>
>I know this is not a good method. Then I use Net::Ping package provided
>by perl. But it works quite slowly.

Did you try using a timeout value? Example:

#!/usr/bin/perl -w

use Net::Ping;

my $p = Net::Ping->new('icmp');

my @addresses = qw(198.113.30.1 198.113.1.139 198.123.234.34 198.123.234.45);
foreach (@addresses){
    print "$_:",$p->ping($_,1) ? "Happy" : "Sad","\n";
}
__END__

>
>Can someone give me some advice how to do it,or tell me where can I find
>a free ping script written in perl?

If the above works for you, consider it a gift. ;-)

>Thank you in advance.
>
>long xue
>long@gb.com.cn
>
>JiTong Communication Co.,LTd.

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 13 Mar 1998 08:57:15 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: You have 1 message(s) - how to print plurals?
Message-Id: <350deffd.3945317@news.tornado.be>

Dave Bushong <spamfree@yahoo.com> wrote:

>I have a pet peeve about having a ten thousand dollar computer telling
>me "1 file(s) copied", when it's a matter of checking whether or not the
>count is one.  In 'C', there is usually something in the printf that
>uses the ternary operator, e.g., prinf ("%d file%s\n", count,
>count==1?"":"s");

I think writing a module for this is a bit overjkill. But I prefer 

    sprintf "Your have copied %d %s", $count, $count==1?'file':'files');
to
    sprintf "Your have copied %d file%s", $count, $count==1?'':'s');

especially when it comes to words that don't just want an extra "s"
added, like copy/copies.

	Bart.


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2088
**************************************

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