[13091] in Perl-Users-Digest
Perl-Users Digest, Issue: 501 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 12:07:20 1999
Date: Fri, 13 Aug 1999 09:05:13 -0700 (PDT)
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 Aug 1999 Volume: 9 Number: 501
Today's topics:
Re: A Guide: How to ask better questions <thf@cisunix.unh.edu>
Re: Bits and Bytes ... (Stefan Scholl)
C<print <FILE>;> -- is it optimized <jeffp@crusoe.net>
Capturing input from the keyboard <liber8r@mcs.net>
Re: Capturing input from the keyboard <rwatkins@springer-ny.com>
Re: CGI Lite <Jonathan_Epstein@nih.gov>
code references to builtin functions (Anno Siegel)
Re: code references to builtin functions (Abigail)
Re: code references to builtin functions (Anno Siegel)
Compare Two FILES <rvdd@iafrica.com>
Re: is our reese the author of mysql book? <elaine@chaos.wustl.edu>
Re: Japanese Girl Needs Help. <elaine@chaos.wustl.edu>
Re: Japanese Girl Needs Help. (Abigail)
Re: Japanese Girl Needs Help. <jcreed@cyclone.jprc.com>
Re: list length <rwatkins@springer-ny.com>
Re: Looking for a solution to the problem localtime and (Abigail)
Re: Making a new web page out of an existing page (Eddie)
Newbie question <gjmorey@uwaterloo.ca>
Possible Perl Bug or Just Me <stirling@banet.net>
Re: problem with ping() in perl <elaine@chaos.wustl.edu>
Re: problem with ping() in perl <stirling@banet.net>
Re: problem with ping() in perl (Malcolm Ray)
Re: problem with ping() in perl (Malcolm Ray)
Problems connecting to some web servers!!!! <dafydd.richards@securetrading.com>
Re: Review for Algo. in Perl <elaine@chaos.wustl.edu>
Re: Review for Algo. in Perl (Anno Siegel)
Re: Sending mail to "QuestionExchange" (Anno Siegel)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Aug 1999 10:50:29 -0400
From: Timothy Frye <thf@cisunix.unh.edu>
Subject: Re: A Guide: How to ask better questions
Message-Id: <37B430B5.662293E4@cisunix.unh.edu>
{snip}
> There you go; a 160-line dissertation on why questions go unanswered.
> Now don't let me hear you saying nobody ever answers your questions.
Here, here!
Good show. I don't post much, but I lurk here a lot. I found this to be such
a great post that I printed it out so I could give it to some friends who like
to post in other groups.
-Tim
------------------------------
Date: 13 Aug 1999 15:12:41 GMT
From: stesch@parsec.rhein-neckar.de (Stefan Scholl)
Subject: Re: Bits and Bytes ...
Message-Id: <slrn7r8df9.not.stesch@parsec.rhein-neckar.de>
On Fri, 13 Aug 1999 13:08:05 +0900, Victor Alekhin <hedin@wizcom.ru> wrote:
> Is it possible to write a perl script that
> will make something like:
>
> mov al,ByteData
> xor al,255
> mov cx,8
> @1: rcl al,1
> rcr ah,1
> loop @1
> mov ByteData,ah
print <<'FOO';
mov al,ByteData
xor al,255
mov cx,8
@1: rcl al,1
rcr ah,1
loop @1
mov ByteData,ah
FOO
------------------------------
Date: Fri, 13 Aug 1999 10:46:16 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: C<print <FILE>;> -- is it optimized
Message-Id: <Pine.GSO.4.10.9908131040440.3761-100000@crusoe.crusoe.net>
I ran a test to see how to best read a big file, and print it.
Here's test.pl:
#!/usr/bin/perl -MBenchmark=timethese
open OUT, ">/dev/null";
open FILE, "big";
timethese(4, {
array => q{ @array = <FILE>; print OUT @array; seek FILE, 0, 0 },
loop => q{ print OUT while <FILE>; seek FILE, 0, 0 },
slurp => q{ print OUT <FILE>; seek FILE, 0, 0 },
});
The file "big" is 2032350 bytes.
% wc big
104244 261528 2032350 big
Here's my preliminary thought:
I know storing a file to an array and then printing is slow. But how do
printing the file straight up, or printing it line by line compare?
The results baffled me a little:
Benchmark: timing 4 iterations of array, loop, slurp...
array: 13 wallclock secs (11.99 usr + 1.32 sys = 13.31 CPU)
loop: 15 wallclock secs (10.25 usr + 0.43 sys = 10.68 CPU)
slurp: 10 wallclock secs ( 9.22 usr + 0.32 sys = 9.54 CPU)
First, disregard the left-most time, since obviously loop did not take 15
seconds.
So we have:
array => 13.31
loop => 10.68
slurp => 9.54
Oh dear. I thought the while loop would be better than slurping the file
in the C<print <FILE>;> statement.
Has the 'slurp' use been optimized in Perl? If so, that'd be a good thing
to know.
--
jeff pinyan japhy@pobox.com japhy+perl@pobox.com japhy+crap@pobox.com
japhy's little hole in the (fire) wall: http://www.pobox.com/~japhy/
japhy's perl supposit^Wrepository: http://www.pobox.com/~japhy/perl/
The "CRAP" Project: http://www.pobox.com/~japhy/perl/crap/
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Fri, 13 Aug 1999 09:56:44 -0500
From: "liberator.net" <liber8r@mcs.net>
Subject: Capturing input from the keyboard
Message-Id: <7p1bvj$ihi$1@Nntp1.mcs.net>
Sure it sounds simple, but I'm not familiar with perl. I want to quiz
people on adding signed integers. I know how to randomly generate numbers
but how do I wait for a keyboard response, capture the input, and test it
for correctness.
I have Perl In a Nutshell by O'Reilly but something tells me I should have
bought Perl for Dummies.
:-)
If you check comp.lang.perl.tk, I have been unsuccessfully experimenting
with the Tk module. I'd rather stick to the basics if it's possible. Your
knowledge and advice will be appreciated. Thanks
--
The Liberator
E-Mail: news@liberator.net
Web Site: http://www.liberator.net/
------------------------------
Date: Fri, 13 Aug 1999 11:46:11 -0400
From: Robert Watkins <rwatkins@springer-ny.com>
Subject: Re: Capturing input from the keyboard
Message-Id: <37B43DC3.75364102@springer-ny.com>
Try:
use strict;
print "Please enter a number: ";
chomp(my $user_num = <STDIN>);
Then manipulate $user_num as you wish
-- Robert Watkins
"liberator.net" wrote:
>
> Sure it sounds simple, but I'm not familiar with perl. I want to quiz
> people on adding signed integers. I know how to randomly generate numbers
> but how do I wait for a keyboard response, capture the input, and test it
> for correctness.
>
> I have Perl In a Nutshell by O'Reilly but something tells me I should have
> bought Perl for Dummies.
>
> :-)
>
> If you check comp.lang.perl.tk, I have been unsuccessfully experimenting
> with the Tk module. I'd rather stick to the basics if it's possible. Your
> knowledge and advice will be appreciated. Thanks
>
> --
> The Liberator
>
> E-Mail: news@liberator.net
> Web Site: http://www.liberator.net/
------------------------------
Date: Fri, 13 Aug 1999 11:22:45 -0500
From: Jonathan Epstein <Jonathan_Epstein@nih.gov>
To: Jose <jose@nospam_nitefever.com>
Subject: Re: CGI Lite
Message-Id: <37B44655.2C907B52@nih.gov>
There are some great resources for CGI.pm at:
http://www.wiley.com/compbooks/stein/source.html
http://stein.cshl.org/WWW/software/CGI/
HTH,
- Jonathan
Jose wrote:
> I'm looking to use CGI Lite, I was wondering if there is a website
> that explains how to really use CGI_Lite.pm, or if many of you out
> there use CGI.pm, is there a page to use CGI.pm?
>
> Thanks...
------------------------------
Date: 13 Aug 1999 14:36:40 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: code references to builtin functions
Message-Id: <7p1aho$si5$1@lublin.zrz.tu-berlin.de>
Darwin O.V. Alonso <dalonso@u.washington.edu> wrote in comp.lang.perl.misc:
>
>
>I want a perl script to evaluate the builtin perl function that
>I give as a, command line argument. E.G.:
> trig.p sin
>evaluates sin at some predetermined value.
>
>I can do it using eval, and the following snipit works:
> ...
> $function = shift(@ARGV); #$ARGV[0] = "sin"
> $f = eval "$function ($pi * ( 4/100) )","\n";
> ...
I think that's your best choice. You want to execute a string
as Perl code. That's what eval is for, among other things.
Coderefs to builtins don't work. Builtins aren't perl code.
Of course you can wrap your trig functions in a hash of anonymous
subs like this:
my %trigtab = (
sin => sub { sin shift},
cos => sub { cos shift},
# etc
);
Call them via
my $some_angle = 3.14159*4/100;
my $func = shift; # shifts @ARGV
my $val = $trigtab{ $func}->( $some_angle);
>And, I can do it using code references if I write my own function:
[solution involving symbolic references to code snipped]
Anno
------------------------------
Date: 13 Aug 1999 10:15:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: code references to builtin functions
Message-Id: <slrn7r8dkm.f3h.abigail@alexandra.delanet.com>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXXIII
September MCMXCIII in <URL:news:7p1aho$si5$1@lublin.zrz.tu-berlin.de>:
''
'' Of course you can wrap your trig functions in a hash of anonymous
'' subs like this:
''
'' my %trigtab = (
'' sin => sub { sin shift},
'' cos => sub { cos shift},
'' # etc
'' );
''
'' Call them via
''
'' my $some_angle = 3.14159*4/100;
'' my $func = shift; # shifts @ARGV
''
'' my $val = $trigtab{ $func}->( $some_angle);
What's the purpose of the hash? You get an extra level of indirection,
more characters to type, and you lose many of the features 'use strict;'
gives you.
my %trigtab = (
sin => sub { sin shift},
cos => sub { cos shift},
);
# Oops, didn't create.
$trigtab {tan} -> ($some_angle);
That gives a runtime error, while the following gives a compile time error:
$sin = sub {sin shift};
$cos = sub {cos shift};
# Oops, didn't create.
$tan -> ($some_angle);
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 13 Aug 1999 15:36:54 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: code references to builtin functions
Message-Id: <7p1e2m$smt$1@lublin.zrz.tu-berlin.de>
Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXXIII
>September MCMXCIII in <URL:news:7p1aho$si5$1@lublin.zrz.tu-berlin.de>:
>''
>'' Of course you can wrap your trig functions in a hash of anonymous
>'' subs like this:
>''
>'' my %trigtab = (
>'' sin => sub { sin shift},
>'' cos => sub { cos shift},
>'' # etc
>'' );
>''
>'' Call them via
>''
>'' my $some_angle = 3.14159*4/100;
>'' my $func = shift; # shifts @ARGV
>''
>'' my $val = $trigtab{ $func}->( $some_angle);
>
>
>What's the purpose of the hash? You get an extra level of indirection,
>more characters to type, and you lose many of the features 'use strict;'
>gives you.
While I'm sure you have a point, I'm not sure I get it. It's another
way to call builtins by their name given as a string (look, no eval).
And it works fine under strict as far as it goes.
>
> my %trigtab = (
> sin => sub { sin shift},
> cos => sub { cos shift},
> );
>
> # Oops, didn't create.
> $trigtab {tan} -> ($some_angle);
>
>That gives a runtime error, while the following gives a compile time error:
>
> $sin = sub {sin shift};
> $cos = sub {cos shift};
>
> # Oops, didn't create.
> $tan -> ($some_angle);
Is that the Californian melanoma-be-dammed attitude towards tan?
Who wants it anyway? But seriously, you lost me here.
tan => sub { my $x = shift; sin( $x)/cos( $x) },
but whom am I telling that...
Anno
------------------------------
Date: Fri, 13 Aug 1999 17:45:35 +0200
From: "Romiko" <rvdd@iafrica.com>
Subject: Compare Two FILES
Message-Id: <7p1ev1$2frl$1@nnrp01.ops.uunet.co.za>
Howzit
I have been trying to write a script that compares two similar files and
updates the changes , I have been trying for two days and cannot get it
right. FileA is the Table that needs to be updated and fileB is the table
with the latest records. The third field in FILEA needs to be comapared
with the first field in FILEB
FileA
002233791|10001|7|Romiko van de dronker|021/54007/13
002233792|10001|7|Romiko van de dronker|022/54007/14
002333745|10002|14|Bob Harrison|021/53014/12
002543578|10003|16|Harry Ford|429/85016/11
FileB
7|Romiko van de dronker|021/54007/13
7|Romiko van de dronker|022/54007/14
8|Michael Bake|021/69008/12
14|Bob Harrison|021/53014/12
16|Harry Ford|429/85016/11
16|Harry Ford|430/85016/12
200|Joe Blogs|021/54200/13
23333|Gary Player|022/23333/45
OUTPUT1
002233791|10001|7|Romiko van de dronker|021/54007/13
002233792|10001|7|Romiko van de dronker|022/54007/14
8|Michael Bake|021/69008/12
002333745|10002|14|Bob Harrison|021/53014/12
002543578|10003|16|Harry Ford|429/85016/11
16|Harry Ford|430/85016/12
200|Joe Blogs|021/54200/13
23333|Gary Player|022/23333/45
OUTPUT2
8|Michael Bake|021/69008/12
16|Harry Ford|430/85016/12
200|Joe Blogs|021/54200/13
23333|Gary Player|022/23333/45
As you can see I need to take the changes in FILEB and compare them to FileA
and then output the changes, also notice that Harry has opened another
account and his customer number stays the same (16).
Thanks for your help guys
Romiko
------------------------------
Date: Fri, 13 Aug 1999 10:28:19 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: is our reese the author of mysql book?
Message-Id: <37B42AF7.665D2248@chaos.wustl.edu>
"Daniel S. Lewart" wrote:
> Not yet. However, we would welcome the prodigal child,
> although he would have to pay for his own pizza.
Well, hey, go out and find him! Certainly you couldn't miss his ultra
sexy blue escort [ this _must_ be why he gets all the chicks ;) ] with
his url emblazoned on the back window. YES! kidnap him and force him to
eat pizza while shredding his code before his eyes!
> I will not taunt -HFB-,
:)
e.
------------------------------
Date: Fri, 13 Aug 1999 10:41:38 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Japanese Girl Needs Help.
Message-Id: <37B42E16.436712E5@chaos.wustl.edu>
Abigail wrote:
> Since we have a lunch appointment, why don't we discuss this
> over sushi tomorrow? Oh, wait, you are the other Japanese Girl.
Already picking up other women?! *gasp* That's it, the wedding is off! :)
> !! I am trying to make a PERL script that will
>
> That's spelled Perl.
it rhymes with gurl and that stands for trouble...right here in river city....
e.
------------------------------
Date: 13 Aug 1999 09:54:27 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Japanese Girl Needs Help.
Message-Id: <slrn7r8ccf.f3h.abigail@alexandra.delanet.com>
Elaine -HFB- Ashton (elaine@chaos.wustl.edu) wrote on MMCLXXIII September
MCMXCIII in <URL:news:37B42E16.436712E5@chaos.wustl.edu>:
,, Abigail wrote:
,, > Since we have a lunch appointment, why don't we discuss this
,, > over sushi tomorrow? Oh, wait, you are the other Japanese Girl.
,,
,, Already picking up other women?! *gasp* That's it, the wedding is off! :)
Heh! She's one of my bridesmaids!
Abigail
--
sub J::FETCH{Just }$_.='print+"@{[map';sub J::TIESCALAR{bless\my$J,J}
sub A::FETCH{Another}$_.='{tie my($x),$';sub A::TIESCALAR{bless\my$A,A}
sub P::FETCH{Perl }$_.='_;$x}qw/J A P';sub P::TIESCALAR{bless\my$P,P}
sub H::FETCH{Hacker }$_.=' H/]}\n"';eval;sub H::TIESCALAR{bless\my$H,H}
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 13 Aug 1999 10:51:29 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Japanese Girl Needs Help.
Message-Id: <a1zozvn37y.fsf@cyclone.jprc.com>
Elaine -HFB- Ashton <elaine@chaos.wustl.edu> writes:
> Abigail wrote:
> > Since we have a lunch appointment, why don't we discuss this
> > over sushi tomorrow? Oh, wait, you are the other Japanese Girl.
>
> Already picking up other women?! *gasp* That's it, the wedding is off! :)
[sfx: organ music]
Tune in next time for the ludicrously dramatic conclusion of
this episode of As The Camel Turns...
---Jason
------------------------------
Date: Fri, 13 Aug 1999 10:42:01 -0400
From: Robert Watkins <rwatkins@springer-ny.com>
Subject: Re: list length
Message-Id: <37B42EB9.B6DE66F5@springer-ny.com>
How about:
scalar(@listarray)
which gives the actual number of elements in the array, not the index of
the last element, as $#listarray does.
-- Robert Watkins
"William M." wrote:
>
> Based on your attempts, I'm not sure if this answers your question, but
> here goes anyway.
>
> @listarray=("One","Two","Three","Four");
> print "There are $#listarray elements (starting at zero), and the last
> one is $listarray[$#listarray]\n";
> print "All of them are:\n",join("\n",@listarray),"\n";
>
> My $0.02 follows (to others, not to the poster).
> <soapbox>
> Be nice to newbees when they appear.
> </soapbox>
>
> Gerhard Muth wrote:
>
> > Simple Question:
> >
> > Is there a way to get the number of elements of a list WITHOUT
> > assigning it to a variable?
> >
> > e.g. Thread->list gives a list of Threads. This works fine but is
> > not what I want:
> >
> > @l = Thread->list;
> > print $#l." threads in list";
> >
> > I looked to a lot documentation as well as faqs but could not
> > find a method or function to get the number of elems of the list.
> >
> > I would expect something like Thread->list->length or
> > length(Thread->list)
> > or anything else.
> >
> > Cheers,
> > Gerhard
------------------------------
Date: 13 Aug 1999 09:56:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <slrn7r8ch4.f3h.abigail@alexandra.delanet.com>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXXIII September
MCMXCIII in <URL:news:37b40ba9@cs.colorado.edu>:
$$ [courtesy cc of this posting mailed to cited author]
$$
$$ In comp.lang.perl.misc,
$$ abigail@delanet.com writes:
$$ :I use:
$$ : my $century = $year > 50 ? 19 : 20;
$$
$$ Funny, I always thought we were in the 20th century already,
$$ and that in a few years, we'd be in the 21st century. :-)
I know that, and you know that, but the chap asking that question
wanted 19 or 20 returned. ;-)
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 13 Aug 1999 14:44:33 GMT
From: (Eddie)
Subject: Re: Making a new web page out of an existing page
Message-Id: <37b42f0c.66744483@news.cadvision.com>
On 13 Aug 1999 01:45:29 -0500, abigail@delanet.com (Abigail) wrote:
>Eddie () wrote on MMCLXXI September MCMXCIII in
><URL:news:37b1eddb.102089770@news.cadvision.com>:
>;; Is it possible to create a web page by "stealing" certain text
>;; passages from an existing web page on your web server? I've never
>;; used perl before but if it can do this i'd like to start learning it.
>;; The script would have to search for certain text in a filename and
>;; then generate a new web page using an existing template.
>
>
>Perl can. And that's the end of the thread in this newsgroup.
>Find some l33+ h4X0rz to help you do stealing.
What's l33+ h4X0rz? by 'stealing' I meant getting text from one of my
own existing pages
>
>
>Abigail
>--
>sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
>"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
>*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
>_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
>------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 13 Aug 1999 11:14:59 -0400
From: Damm Dashing <gjmorey@uwaterloo.ca>
Subject: Newbie question
Message-Id: <Pine.SOL.3.95q.990813110902.20321B-100000@hermite.math.uwaterloo.ca>
Dear Folks,
I apologize if this question inadvertantly takes up anyone's time.
I have a while loop that goes:
while ($line = <IN>) {
chop $line;
#do some processing
#print the line
} # while
where IN is the filehandle for an open flatfile. The problem I'm having
is that the flatfile looks like (note: the line numbers are for clarity
purposes only, they don't appear in the actual file):
1. blah blah blah blah blah
2.
3. ***********
4.
5. more text in here, ya dig it?
6. &c...
And the output from the program only returns the first line. The
processing done on the subsequent lines does not remove them, ie. the
script should return multiple lines (it did before I changed my loop
construct to while($line=<IN>)).
I'm wondering what I'm doing wrong here...
Please reply to my e-mail address, in addition to any other places.
Thanks in advance!
Greg.
------------------------------
Date: Fri, 13 Aug 1999 12:00:25 -0400
From: <stirling@banet.net>
Subject: Possible Perl Bug or Just Me
Message-Id: <37b43f74@news1.us.ibm.net>
In the following two scripts the only change is in the single and double
quotes, however, the one with single quotes doesn't work and the one with
double quotes does. I have attached the output of perl -V for my host
system. Please let me know if this is a perl bug or a bug on my system or
my Perl code.
sh.pl (take 1)(the ineffective script):
#!/usr/bin/perl -w
use strict;
$orig='sample.txt';
chmod (0700,$orig);
---------------------------------------
sh1.pl (take 2)(the effective script):
#!/usr/bin/perl -w
use strict;
$orig="sample.txt";
chmod (0700,$orig);
-----------------------------------------------
Here is the output of perl -V:
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos localhost 5.6 generic sun4m sparc sunw,sparcstation '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.7.2.3
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under solaris
Compiled at Dec 21 1997 15:33:51
@INC:
/usr/local/lib/perl5/sun4-solaris/5.00404
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl
.
Sincerely,
Stirling Hughes
purchase9@hotmail.com
------------------------------
Date: Fri, 13 Aug 1999 10:46:06 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: problem with ping() in perl
Message-Id: <37B42F22.417148F1@chaos.wustl.edu>
Hendrik N6ulik wrote:
>
> The following code might be identify if other machine responds
> over tcp/ip. But something is wrong because ping alwais
> returns 0. Why? I have no idea. maybe somebody would help me?
ping uses ICMP not TCP.
e.
------------------------------
Date: Fri, 13 Aug 1999 11:42:06 -0400
From: <stirling@banet.net>
Subject: Re: problem with ping() in perl
Message-Id: <37b43b28@news1.us.ibm.net>
Elaine -HFB- Ashton wrote in message <37B42F22.417148F1@chaos.wustl.edu>...
>Hendrik N6ulik wrote:
>>
>> The following code might be identify if other machine responds
>> over tcp/ip. But something is wrong because ping alwais
>> returns 0. Why? I have no idea. maybe somebody would help me?
>
>ping uses ICMP not TCP.
to do ping with tcp you need to do a ping echo like so:
#!/usr/bin/perl -w
use strict;
use Net::Ping;
$hostname='yourhost.com';
$timeout = 10;
if (pingecho($hostname, $timeout)) {
print 'IT WORKS';
}
-Stirling Hughes
>e.
------------------------------
Date: 13 Aug 1999 15:49:00 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: problem with ping() in perl
Message-Id: <slrn7r8fjc.af2.M.Ray@carlova.ulcc.ac.uk>
On Fri, 13 Aug 1999 16:29:27 +0300, Hendrik N6ulik <hendrik@doora.ee> wrote:
>The following code might be identify if other machine responds
>over tcp/ip. But something is wrong because ping alwais
>returns 0. Why? I have no idea. maybe somebody would help me?
>
>Code is here:
>
>#!/usr/bin/perl
>use Net::Ping;
>$host="192.168.1.1";
>$p = Net::Ping->new("tcp");
That should be 'icmp';
>print $p->ping($host,5);
>print "DOESNT PING\n" unless $p->ping($ip,5));
That line has a syntax error (look at the parentheses). Plus, $ip will
be undefined at this point.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: 13 Aug 1999 15:55:14 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: problem with ping() in perl
Message-Id: <slrn7r8fv2.af2.M.Ray@carlova.ulcc.ac.uk>
On Fri, 13 Aug 1999 11:42:06 -0400, stirling@banet.net <stirling@banet.net>
wrote:
>
>
>Elaine -HFB- Ashton wrote in message <37B42F22.417148F1@chaos.wustl.edu>...
>>Hendrik N6ulik wrote:
>>>
>>> The following code might be identify if other machine responds
>>> over tcp/ip. But something is wrong because ping alwais
>>> returns 0. Why? I have no idea. maybe somebody would help me?
>>
>>ping uses ICMP not TCP.
>
>to do ping with tcp you need to do a ping echo like so:
> #!/usr/bin/perl -w
> use strict;
> use Net::Ping;
>
> $hostname='yourhost.com';
> $timeout = 10;
> if (pingecho($hostname, $timeout)) {
> print 'IT WORKS';
> }
Please don't recommend that. The documentation for current versions of
Net::Ping says this:
pingecho($host [, $timeout]);
To provide backward compatibility with the previous
version of Net::Ping, a pingecho() subroutine is
available with the same functionality as before.
pingecho() uses the tcp protocol. The return values
and parameters are the same as described for the
ping() method. This subroutine is obsolete and may be
removed in a future version of Net::Ping.
Note that pingecho uses TCP. In other words, it tries to connect to
the remote host's 'echo' TCP port. Frequently, the 'echo' service
will be disabled, so this won't work as expected.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: Fri, 13 Aug 1999 16:10:49 +0100
From: "Dafydd Richards" <dafydd.richards@securetrading.com>
Subject: Problems connecting to some web servers!!!!
Message-Id: <7p1c5j$acp$1@starburst.uk.insnet.net>
I'm having problem communicating with some type of web servers using perl
sockets.
I can connect using python or telnet, browser etc, but for some reason it
will not talk to perl.
I example servers are NSL and various Netscape servers, Apache is fine.
Does anybody have any ideas what causes the problem, and a solution if there
is one.
Dafydd.
------------------------------
Date: Fri, 13 Aug 1999 10:31:10 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Review for Algo. in Perl
Message-Id: <37B42BA2.CB5DBFFF@chaos.wustl.edu>
Abigail wrote:
> *** ACHTUNG! ALLES LOOKENSPEEPERS! ***
LOL! Ich spewen mein kaffee while lesen zis.
That's a keeper. :)
e.
------------------------------
Date: 13 Aug 1999 14:49:36 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Review for Algo. in Perl
Message-Id: <7p1ba0$sj5$1@lublin.zrz.tu-berlin.de>
Elaine -HFB- Ashton <elaine@chaos.wustl.edu> wrote in comp.lang.perl.misc:
>Abigail wrote:
>> *** ACHTUNG! ALLES LOOKENSPEEPERS! ***
>
>LOL! Ich spewen mein kaffee while lesen zis.
>
>That's a keeper. :)
M333 T000!!!1
Anno
------------------------------
Date: 13 Aug 1999 15:17:28 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sending mail to "QuestionExchange"
Message-Id: <7p1cu8$sld$1@lublin.zrz.tu-berlin.de>
David Cassell <cassell@mail.cor.epa.gov> wrote in comp.lang.perl.misc:
>Tom Christiansen wrote:
>>
>> These people are a plague. They do not admit who they are. Anonymity
>> destroys accountability. They overquote, including sigs and spamvert
>> attachments. They give bad answers. Worst of all, they appear to be
>> using this newsgroup as a publicity gimmick to sucker people in to
>> some pay-per-question commerical venture.
>
>It's even worse than that. Take a quick trip to
>www.questionexchange.com if you dare, and look at what the
>site's designers are doing. In order to get yourself registered
>as an expert in a category, you have to answer a question in
>that category. Guess where the questions are coming from?
>
>That's right. From Usenet newsgroups. This may not even be
Oh shit, that's how they do it! Make some poor sod think he's
taking an "exam" and post the results as replies to the questions.
Makes sense now. Disgusting sense.
[...]
>the other. The posters themselves may be blameless for the
>most part, particularly since it is not clear that they are
>aware of the source of the questions.
...nor, probably, what their answers are used for. That's why
they must hide the net-id of their contributors. And why we are
never going to see a followup to a correction.
>of a long list of comp topics listed, so this is probably
>going on in another 20 newsgroups.
Except clpm, deja finds these:
comp.os.linux.setup
comp.os.linux.hardware
comp.lang.javascript
comp.lang.java.programming
comp.lang.c
comp.lang.c++
comp.os.linux.x
comp.os.linux.networking
comp.lang.tcl
They had 300+ postings in four days (8-12 Aug).
Well, I guess they won't last long. The nature of their fraud will
soon be known all over usenet.
Anno
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 501
*************************************