[9277] in Perl-Users-Digest
Perl-Users Digest, Issue: 2872 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 14 21:07:17 1998
Date: Sun, 14 Jun 98 18:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 14 Jun 1998 Volume: 8 Number: 2872
Today's topics:
Re: [Q] Help creating a perl cgi script - word1.txt [ <angst@scrye.com>
Re: A Simple Question! (Martien Verbruggen)
Bug? Why is this... jvb@universe.digex.net
Re: Bug? Why is this... (T. Ames)
Re: Bug? Why is this... (Allan M. Due)
Re: Bug? Why is this... (Mike Heins)
Re: Bug? Why is this... (Tad McClellan)
Re: COMPARING TIME & DATE <gnat@frii.com>
Re: conditional curiosity... (Tad McClellan)
Re: editing middle of file (Todd C. Ames)
Re: Have we got a good free Perl manual? (Christopher B. Browne)
Re: how to honestly make money fast... <angst@scrye.com>
Re: lambda fun in Perl <schwartz@cs.tu-berlin.de>
Re: New module/pragma "enum.pm" (was "fields.pm") <zenin@bawdycaste.org>
perl 5 on NT4 problems <twohawks@lcc.net>
Re: perl script emulates "last" command <angst@scrye.com>
Re: Redirecting STDOUT/STDERR to a file (Martien Verbruggen)
Re: Regex Help! (Tad McClellan)
Re: Return values of comparison operators (Damian Conway)
Re: Return values of comparison operators gerg@shell.wco.com
Re: REVIEW: Perl CGI Programming - No Experience Requir (Tad McClellan)
Re: silly tired question... (Jim Britain)
Socket newbie: Problems running script (The Walrus)
Re: To clear this all up (Re: Preventing file conflicts <schwartz@cs.tu-berlin.de>
Re: Urgent ! Where to find perl5.004 for HP-UX (Martien Verbruggen)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Jun 1998 00:35:09 GMT
From: angst <angst@scrye.com>
Subject: Re: [Q] Help creating a perl cgi script - word1.txt [1/1]
Message-Id: <6m1q7t$ltk$3@jelerak.scrye.com>
anonymous <anonymous@nouce.net> wrote:
: Thanks for your fast responds. I have not started this at all since I am
: not a expert in perl. I was wondering if someone might be able to write
: one so I can learn from that.
Absolutely. Give me money.
Perl is a _programming_ language. _programming_ perl is _work_.
What makes you think anyone is going to give you a complete script
for free? You should be thankful enough that people are willing to
give you help with _your_ perl for free. Giving help to someone who
has been suffering over a problem, and, after READING ALL THE DOCUMENTATION,
asks a questions about his code, is fun. Well, not always, but it at
least gives one the feeling that they are helping someone that has
the desire to learn, and has taken the time to learn for themselves, and
is therefore worth teaching.
Writing perl programs from scratch is also fun, when I'm writing scripts
for my own use or for the use of my employers, who give me money to do so.
If you want me to write perl scripts for you without paying me, you're
insane.
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: 15 Jun 1998 00:17:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: A Simple Question!
Message-Id: <6m1p6e$qo7$1@comdyn.comdyn.com.au>
Please read the following information on how to choose a good subject
line:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
In article <35817B2B.27B3D09B@hotmail.com>,
Meena Chockalingam <cmeena@hotmail.com> writes:
> Is there a way I can check if a directory is empty before trying to list
> it? See the following code...
In the strictest sense: hardly possible. Less strict: Yes, you can use
opendir/readdir/closedir. This does open the directory, and requires
you to read the contents, but I interpret this question in such a way
that you are trying to avoid spawning an external process when it is
going to fail anyway.
Be aware that directories almost always contain pointers to the
current and parent directory (if there is such a thing). This means
that directories never are 'empty'. Which leads me to the remark: you
don't really want to test if the directory is empty, but if it
contains any files that match your pattern.
> IfErrorDir = "/home/CRC";
forgot a $?
> open(IN, "$IfErrorDir") || die "could not open $IfErrorDir\n";
is ErrorDir a file or a directory (see later)? For now I'll assume
that it is a file AND a directory. Bit confusing though.
> while (<IN>) {
> chop;
chomp is safer.
> $theFile = $_;
> open(LS, "ls $IfErrorDir/$theFile/*.ifErrors|") || die "could not
> list the $IfErrorDir/$theFile\n";
> while (<LS>) {
> ..............
> }
> close(LS);
> }
> close(IN);
Maybe something like:
#!/usr/local/bin/perl -w
use strict;
my $IfErrorDir = "CRC";
open(IN, "$IfErrorDir") || die "could not open $IfErrorDir: $!";
while (<IN>)
{
chomp;
my $theDir = "$ifErrorDir/$_";
opendir (DIR, $theDir) || die "Couldn't open $theDir: $!";
my @files = grep { !/^\.\.?$/ && /^.+\.ifErrors$/ } readdir(DIR);
closedir(DIR);
if (@files)
{
# do your processing on each of the files
}
else
{
# no files to process
}
}
Martien
PS. You could also look into globbing (perldoc -f glob), but I'd
prefer to use the functions mentioned above.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: Sun, 14 Jun 1998 22:47:13 GMT
From: jvb@universe.digex.net
Subject: Bug? Why is this...
Message-Id: <6m1jt9$mus@universe.digex.net>
($a, $b, $c) = split ('\t', "blah blah blah");
print "$a $b $c\n";
outputs: blah blah blah
$line = join ('\t', "blah", "blah", "blah");
print "$line\n";
outputs: blah\tblah\tblah\t
Yes, I mean it outputs "\t" exactly, that is not my way of symbolizing a
tab. Why is it that split could figure out '\t' was a tab and join
couldn't? Regardless of which way '\t' should be interpreted, shouldn't
they both interpret it the same way? I.e., both view '\t' as a tab or
both view '\t' as exactly "\t"?
Joseph V. Benik, Jr.
------------------------------
Date: Sun, 14 Jun 1998 23:27:50 GMT
From: ames0009@tc.umn.edu (T. Ames)
Subject: Re: Bug? Why is this...
Message-Id: <35845878.18403615@news.tc.umn.edu>
On Sun, 14 Jun 1998 22:47:13 GMT, jvb@universe.digex.net wrote:
>($a, $b, $c) = split ('\t', "blah blah blah");
>print "$a $b $c\n";
>
>outputs: blah blah blah
>
>
>$line = join ('\t', "blah", "blah", "blah");
>print "$line\n";
>
>outputs: blah\tblah\tblah\t
>
You are using single-quotes around \t in your call to join - in which
case the backslash loses its special meaning. Now, you also use
single quotes in your call to split - but I think the difference here
is that split is performing a pattern match operation, join isn't.
Consider this: if you use
$line =~ '\t';
the pattern match will work if there are any tabs on the line.
Therefore, for some reason, you can substitue single quote marks for
the / / marks when do a pattern match operation.
But WHY? I don't know.....
HTH,
T. Ames
>>>>>>>>>>>>>>>>>>>
Todd C. Ames
ames0009@tc.umn.edu
University of Minnesota
------------------------------
Date: 14 Jun 1998 23:43:32 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: Re: Bug? Why is this...
Message-Id: <6m1n74$dlh$0@206.165.146.42>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6m1jt9$mus@universe.digex.net>, jvb@universe.digex.net
(jvb@universe.digex.net) posted...
|($a, $b, $c) = split ('\t', "blah blah blah");
|print "$a $b $c\n";
|
|outputs: blah blah blah
|
|
|$line = join ('\t', "blah", "blah", "blah");
|print "$line\n";
|
|outputs: blah\tblah\tblah\t
|
|Yes, I mean it outputs "\t" exactly, that is not my way of symbolizing a
|tab. Why is it that split could figure out '\t' was a tab and join
Well, I would say that this is a feature not a bug because, to me '\t' is
not a tab is two characters a \ and a t. Now "\t" would be a tab to me,
let's see.
$line = join ("\t", "blah", "blah", "blah");
print "$line\n";
prints:
blah blah blah
Cool, just what we want.
Now I just find it especially cool that Perl can kind of figure out what
you want with ($a, $b, $c) = split ('\t', "blah blah blah");
print "$a $b $c\n";
Because ($a, $b, $c) = split ("\t", "blah blah blah");
print "$a $b $c\n"; is more "correct" and obtains the same result :-)
blah blah blah
And Perl does fine with
($a, $b, $c) = split ('\t', "blah\tblah\tblah");
print "$a $b $c\n";
prints:
blah blah blah
Is this a cool language or what.
--
Allan M. Due
Due@Murray.Fordham.edu
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: 14 Jun 1998 19:59:12 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Bug? Why is this...
Message-Id: <358463d0.0@news.one.net>
T. Ames <ames0009@tc.umn.edu> wrote:
> On Sun, 14 Jun 1998 22:47:13 GMT, jvb@universe.digex.net wrote:
>>($a, $b, $c) = split ('\t', "blah blah blah");
>>print "$a $b $c\n";
>>
>>outputs: blah blah blah
>>
>>
>>$line = join ('\t', "blah", "blah", "blah");
>>print "$line\n";
>>
>>outputs: blah\tblah\tblah\t
>>
> You are using single-quotes around \t in your call to join - in which
> case the backslash loses its special meaning. Now, you also use
> single quotes in your call to split - but I think the difference here
> is that split is performing a pattern match operation, join isn't.
> Consider this: if you use
> $line =~ '\t';
> the pattern match will work if there are any tabs on the line.
> Therefore, for some reason, you can substitue single quote marks for
> the / / marks when do a pattern match operation.
> But WHY? I don't know.....
It is specified that way in the documentation:
split /PATTERN/,EXPR,LIMIT
join EXPR,LIST
If you need more explanation than this, then I suggest you start
at the beginning in the man pages. I did that after programming Perl
for about 6 months, and my eyes were opened quite a bit.
Regards,
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
Just because something is 131 Willow Lane, Floor 2 | || _ \
obviously happening doesn't Oxford, OH 45056 | || |_) |
mean something obvious is <mikeh@minivend.com> |___| _ <
happening. --Larry Wall 513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Sun, 14 Jun 1998 19:05:46 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Bug? Why is this...
Message-Id: <qgo1m6.srf.ln@localhost>
jvb@universe.digex.net wrote:
: ($a, $b, $c) = split ('\t', "blah blah blah");
: print "$a $b $c\n";
: outputs: blah blah blah
: $line = join ('\t', "blah", "blah", "blah");
: print "$line\n";
: outputs: blah\tblah\tblah\t
: Yes, I mean it outputs "\t" exactly, that is not my way of symbolizing a
: tab. Why is it that split could figure out '\t' was a tab and join
: couldn't?
Since your question is about split() and join(), perhaps we should
read up on those two functions in the fine Perl documentation
(perlfunc, in this case):
=item split /PATTERN/,EXPR
=item join EXPR,LIST
Hmmm. The first argument to split() is a pattern.
You did not give it a pattern.
You gave it a string.
Q: What does perl do when it finds a string where it expected a pattern?
A: It interprets the string as a regular expression.
So the regex engine sees the two character string '\t', which it, in turn,
interprets as a tab character.
Had you used double quotes then the regex engine would see the
single tab character (since the double quotes would have interpolated it).
: Regardless of which way '\t' should be interpreted, shouldn't
: they both interpret it the same way? I.e., both view '\t' as a tab or
: both view '\t' as exactly "\t"?
'\t' as a regular expression (pattern) and '\t' as a string are
not the same, so different interpretations seem reasonable.
It is all very confusing.
Much easier to give a pattern when the function description calls
for a pattern...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Jun 1998 18:17:05 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: COMPARING TIME & DATE
Message-Id: <5qd8cbmsce.fsf@prometheus.frii.com>
sb@engelschall.com (Steffen Beyer) writes:
> Hint #1: http://freshmeat.net/ is a server where new Linux software is
> announced daily.
I love freshmeat. If you (not you, Steffen, but you EVERYONE) are a
module or program author, please consider announcing new versions of
modules through freshmeat. It's a great resource and can only get
better.
Nat
(slashdot.org is another great site for Linux/Unix news and chat)
------------------------------
Date: Sun, 14 Jun 1998 17:41:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: conditional curiosity...
Message-Id: <ijj1m6.ehf.ln@localhost>
Brent Verner (REPLY_TO_damonbrent@earthlink.net) wrote:
: is there any benefit (aside from less lines of code) to using :
: $a = $b if $b;
: rather than :
: if ($b)
: {
: $a = $b;
: }
: is the former less expensive?
Ask the Benchmark module...
----------------------
#!/usr/bin/perl -w
use Benchmark;
timethese(10000000, {
'inline' => '$b=1; $a = $b if $b',
'structured' => '$b=1; if ($b) {$a = $b}'
});
----------------------
Benchmark: timing 10000000 iterations of inline, structured...
inline: 41 secs (39.77 usr 0.01 sys = 39.78 cpu)
structured: 43 secs (42.07 usr 0.00 sys = 42.07 cpu)
The difference seems hardly discernible.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 14 Jun 1998 22:33:17 GMT
From: ames0009@tc.umn.edu (Todd C. Ames)
Subject: Re: editing middle of file
Message-Id: <35844ec1.15916409@news.tc.umn.edu>
This is one solution I came up with (works fine) - but I would be
interested if anyone has any other ways of approaching this.
$n = 1;
while ($n < @file) {
if ($file[$n-1] =~ /$keyword/gi) {
push (@numbers, $n);
} else {
$n++;
}
}
$n++;
$x = $numbers[0];
$y = $numbers[1] - $numbers[0] - 1;
splice (@file, $x, $y, ("new","stuff","here\n"));
print @file;
Thanks,
T. Ames
>>>>>>>>>>>>>>>>>>>
Todd C. Ames
ames0009@tc.umn.edu
University of Minnesota
------------------------------
Date: 15 Jun 1998 00:35:36 GMT
From: cbbrowne@news.brownes.org (Christopher B. Browne)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <slrn6o8qvg.tuj.cbbrowne@knuth.brownes.org>
On Sun, 14 Jun 1998 20:11:45 GMT, Todd Lehman <lehman@visi.com> posted:
>Barry Margolin <barmar@bbnplanet.com> writes:
>> Well, the words he often chooses are easily misinterpreted. For instance,
>> his references to the existing Perl documentation said, "but they were no
>> good because they weren't free." By "no good" he meant "not acceptable" or
>> "not appropriate", but it's easy to understand why people would interpret
>> it as "not good" == "bad".
>
>Is that sort of thing intentional or is he just a crummy writer? Or does
>he expect all readers to speak his dialect of English? Curious,
He expects you to read the essay elsewhere on the web site:
<http://www.fsf.org/philosophy/free-sw.html>
that explains what he means by "free."
It is not generally considered unreasonable in areas of science and
academics to expect readers to put *some* effort into understanding the
terminology unique to the area of study.
The word "set" is highly ambiguous as it has a whole host of disparate
meanings.
The word "free" has to be interpreted carefully as it has multiple meanings.
Similarly, it is not unreasonable to consider "no good" to be an overloaded
term that must similarly be carefully interpreted.
--
Those who do not understand Unix are condemned to reinvent it, poorly.
-- Henry Spencer <http://www.hex.net/~cbbrowne/lsf.html>
cbbrowne@hex.net - "What have you contributed to Linux today?..."
------------------------------
Date: 15 Jun 1998 00:47:01 GMT
From: angst <angst@scrye.com>
Subject: Re: how to honestly make money fast...
Message-Id: <6m1qu5$ltk$4@jelerak.scrye.com>
Charlie Pratt <web3151@charweb.org> wrote:
Send me all of your money. If you send me $10,000, i will send you
20,000 cents. If you send me $10,000,000, I will send you 20,000,000 cents.
You notice how the numbers are twice as big? You can't lose!
Anything sent under $1,000 will be laughed at, so don't bother.
That barely covers my costs for the hundreds of manhours it costs to
make this amazing new system work.
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: 14 Jun 1998 23:43:52 GMT
From: Martin Schwartz <schwartz@cs.tu-berlin.de>
Subject: Re: lambda fun in Perl
Message-Id: <6m1n7o$c7r$1@news.cs.tu-berlin.de>
Tushar Samant <scribble@pobox.com> wrote:
> Use the overload facility by the mighty Ilya Zakharevich:
> (made idiotic for hours of fun)
Fun! Thanks!
Martin
--
// Le degre zero de l'ecriture? Zero probleme!
------------------------------
Date: 15 Jun 1998 00:40:09 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <897871737.535143@thrush.omix.com>
Brendan O'Dea <bod@compusol.com.au> wrote:
: Perhaps something like this:
: use enum qw(
: Title FirstName Surname
: Addr1..Addr4 PostCode
: );
Hmm, ok I'll buy that. Hell, I might even use that. :-)
>snip<
: Really? K&R says:
:
: ``Enumerations provide a convenient way to associate constant values
: with names, an alternative to #define ...''
: and provides examples including:
: enum escapes { BELL = '\a', BACKSPACE = '\b', TAB = '\t',
: NEWLINE = '\n', VTAB = '\v', RETURN = '\r' };
Blgh...ok... Well, this wouldn't be the first time I've disagreed
with K&R and won't be the last. :-)
This is a little different however, then what enum.pm can offer.
C enum can have a name, where this really isn't possible or useful
in Perl. There wouldn't be an "escapes" name used in Perl as the
language doesn't have any ability to do type checking with it.
>snip<
: This is also a common idiom in C++ (these examples are taken from
: include files in the standard library):
: enum {ALIGN = 8};
: enum {MAX_BYTES = 128};
: enum {NFREELISTS = MAX_BYTES/ALIGN};
Hmm...but why? It's very non-intuitive in my book. If you want
a single constant one should use a sigle constant.
: enum {
: skipws = 01,
: left = 02,
: right = 04,
: /* ... */
: };
Blagh, same thing. The constant module should have this support,
not an enum module.
>snip<
: The constant module requires separate imports so that constant arrays
: may be defined.
Bad design for constant.pm IMHO. Array constants should have
used refs so that one could do this:
use constant (
MY_ARRAY => [ 'some', 'list', 'of', 'stuff' ],
MY_SCALAR => 'value',
## ... etc ...
);
This would have been a much cleaner interface IMHO, and provided
lower overhead simply because it doesn't require separate imports.
Oh well, hindsight is 20/20. :-)
Hmm, what about a constants.pm (extra 's') module that works like this?
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Sun, 14 Jun 1998 17:36:55 -0500
From: "2c00l" <twohawks@lcc.net>
Subject: perl 5 on NT4 problems
Message-Id: <6m1jl2$k3o@atlas.lcc.net>
I've got perl5 installed on NT4 and am getting the following error when I
call any cgi script- "%1 is not a valid Windows NT application."
Anyone have an idea?
Thanks
------------------------------
Date: 15 Jun 1998 00:09:51 GMT
From: angst <angst@scrye.com>
Subject: Re: perl script emulates "last" command
Message-Id: <6m1oof$ltk$2@jelerak.scrye.com>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: :I would like to know any perl script can emulate the "last"
: :command in UNIX.
: :Please mail. Thanks for help.
: #!/usr/bin/perl
: # whenon
: # tchrist@perl.com
Who are you and what have you done with the real tom?
just when I thought I could predict your answers to questions like this,
you go and give the guy an actual script. I'm disappointed.
You realize, of course, the next question:
'I would like a perl script that emulates the UNIX operating system.'
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: 14 Jun 1998 23:29:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
To: "Michael D. Schleif" <mike.schleif@aquila.com>
Subject: Re: Redirecting STDOUT/STDERR to a file
Message-Id: <6m1mck$qbh$1@comdyn.comdyn.com.au>
[Posted and Mailed]
In article <3582062F.4A51B171@aquila.com>,
"Michael D. Schleif" <mike.schleif@aquila.com> writes:
1 line of actual reply
3 quoted lines and 1 attribution line
12 lines for the signature
9+ lines for the MIME stuff
30+ lines for the cryptographic sig.
Total article size: 5606 bytes, after removal of all the crud, 1102
bytes remain, which gives us a 80% noise figure.
Talk about wasting space and resources. Please, next time you post,
make sure your noise to content ratio is slightly better.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about it's friends.
NSW, Australia |
------------------------------
Date: Sun, 14 Jun 1998 11:30:43 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regex Help!
Message-Id: <jrt0m6.ife.ln@localhost>
Deva Seetharam (psdspss@execpc.com) wrote:
: Nothing really significant.
: I guess Jim Bowlin made a typo in tr.
: It should have a closing "]".
: So, it would be
: tr/[a-zA-Z0-9_:]//dcs;
But only if he wanted square bracket characters to be deleted...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Jun 1998 23:53:21 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Return values of comparison operators
Message-Id: <6m1nph$4f7$1@towncrier.cc.monash.edu.au>
miker3@ix.netcom.com (Michael Rubenstein) writes:
>On 13 Jun 1998 15:24:11 GMT, andrew@pimlott.student.harvard.edu
>(Andrew Pimlott) wrote:
>>I just read that in Icon you can do something like
>>
>>if (0 < x < 10)
>>
>>because < returns it's right operand. I thought Perl was pretty clever to
>>do something like this with || and &&, so why don't we have it for
>>comparison operators?
>>
>>(Don't worry--I'm not suggesting changing existing behavior. Too late for
>>that. Drat.)
There have been plenty of replies explaining why retrofitting Icon's
failure model might not be appropriate. But, of course, there's
nothing to prevent The Perl Gods from extending the grammar so that
multiple comparisons work as expected. Perhaps you should sacrifice
a newbie to the Trinity?
Damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name: Damian Conway addr: School of Computer Science
email: damian@csse.monash.edu.au and Software Engineering
web: http://www.cs.monash.edu.au/~damian Monash University
fax: +61-3-9905-5146 Clayton 3168, AUSTRALIA
------------------------------
Date: 15 Jun 1998 00:26:51 GMT
From: gerg@shell.wco.com
Subject: Re: Return values of comparison operators
Message-Id: <6m1pob$l9d$2@news.ncal.verio.com>
Keywords: coax Dorothy milkweed typescript
mjd@op.net (Mark-Jason Dominus) writes:
>
>It wouldn't be hard to make an operator, say %!, which just returns
>its second argument.
>
Have I misunderstood a subtle difference here, or doesn't the comma
operator already do this? From my 5.004 man perlop:
Comma Operator
Binary "," is the comma operator. In a scalar context it
evaluates its left argument, throws that value away, then
evaluates its right argument and returns that value. This
is just like C's comma operator.
In a list context, it's just the list argument separator,
and inserts both its arguments into the list.
-Greg
------------------------------
Date: Sun, 14 Jun 1998 17:26:20 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <cmi1m6.lef.ln@localhost>
Rahul Dhesi (c.c.eiftj@54.usenet.us.com) wrote:
: The only difference between a list and an array that I can think of is
: that we call a list an array if we use subscript notation on it at least
: once in a program. So the difference appears to be what we do, not what
: it is.
The difference is that 'perlfunc' distinguishes between the two.
eg:
push ARRAY,LIST
splice ARRAY,OFFSET,LENGTH,LIST
So you need to understand the difference if you want to understand
the documentation, and you need to understand Perl's documentation
if you want to understand Perl.
;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 15 Jun 1998 00:16:01 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: silly tired question...
Message-Id: <35846713.6011637@news>
On 14 Jun 1998 07:32:25 GMT, kevin@mercury.ig.utexas.edu (Kevin
Johnson) wrote:
>I'll answer my own question...
>
>: if ($arr[2] == "nsamp") { $nsamp=@_[4]; print $nsamp,"\n",$arr[2],"\n";}
> ^^
>eq for string equality... *bang bang bang*
Simple memory aid on operators:
Stuff that looks like math operators ( = == + ) work on math
variables.
Stuff that looks like words ( eq, ne, etc. ) work on text.
------------------------------
Date: Mon, 15 Jun 1998 00:20:23 GMT
From: spiker@cs.odu.edu (The Walrus)
Subject: Socket newbie: Problems running script
Message-Id: <358466ac.18782385@news.mnsinc.com>
I'm extremely new to Socket perl scripting and scripting with modules
all together. I've been running through my Learning Perl Llama book
looking in the back at the Networking section and trying out some of
the code back there. Seems I can't get any of it to work though. I
know for an in depth discussion on socket programming I should get
Programming Perl but I haven't gotten around to it yet so give me a
break. Here's a script I'm trying to run and what I get when running
it:
#Word for word out of Learning Perl; A Simple Client p246
#!/usr/bin/perl -w
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
or die "cannot connect to daytime port at localhost";
while ( <$remote> ) { print }
What I get when running the script:
"use" may clash with future reserved word at ./net line 2.
syntax error in file ./net at line 2, next 2 tokens "use IO"
syntax error in file ./net at line 3, next 2 tokens "IO:"
Execution of ./net aborted due to compilation errors.
I'm not really understanding what all this means. I figured that
taking it right out of the book, it should work well. Could it
possibly be that my sysadmin set up perl wrong or something? It's a
standard UNIX BSD system. Any help would be appreciated.
-The Walrus
------------------------------
Date: 15 Jun 1998 00:10:08 GMT
From: Martin Schwartz <schwartz@cs.tu-berlin.de>
Subject: Re: To clear this all up (Re: Preventing file conflicts)
Message-Id: <6m1op0$cmm$1@news.cs.tu-berlin.de>
Jeremy Goldberg <jgoldberg@dial-put_dot_here-pipex.com> wrote:
> So all the horrible things Tom and I said to each other were unwarranted.
> Now all I need to know is what a nimrod actually is... :)
A biblical person (Old Testament, 1. Mose 10). He was a great grandson of
Noah (the one with the ark) and "the first gaining power on earth". A mighty
hunter with a big realm. He built the towns Ninive, Rehoboth-Ir and Kelach, and
also Resen. Actually a loud scream formally fits perfectly when talking about
Nimrod, so regard Toms statement as applied literature. Can you imagine
that I actually tried: perldoc -f Nimrod?
;-)
Martin
--
// Le degre zero de l'ecriture? Zero probleme!
------------------------------
Date: 14 Jun 1998 23:54:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Urgent ! Where to find perl5.004 for HP-UX
Message-Id: <6m1nrr$qja$1@comdyn.comdyn.com.au>
Please read the following information on how to choose a good subject
line:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
In article <3581B17D.41C6@vt.edu>,
Yingxiang Wu <yiwu2@vt.edu> writes:
> It's urgent!
It's not urgent for me, or anyone else here, I suppose.
> I want to upgrade the perl in a HP_UX workstation. Is some where I can
> find the newest version of perl.
If it's really that urgent for you, why don't you try one of the
obvious things? Something like a web search on altavista,or look on
yahoo, or try what most people would try:
http://www.perl.com/
http://www.perl.org/
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
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 2872
**************************************