[11569] in Perl-Users-Digest
Perl-Users Digest, Issue: 5169 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 18 16:07:20 1999
Date: Thu, 18 Mar 99 13:00:18 -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 Thu, 18 Mar 1999 Volume: 8 Number: 5169
Today's topics:
converting hi-res time to system tics in Perl <anonymous@anonymous.com>
Re: crypt DES and IDEA compile probs on Solaris 2.7 <mhartwig@lucent.MEOWcom>
Determining GIf and JPG's dimensions (John Swainston)
Re: echo pwd (Nobody)
Help translating an VbScript to PERL <pep_mico@hp.com>
Re: How to #! in Win95? (Nobody)
Re: Input for PERL Course request <elaine@cts.wustl.edu>
Multi-line formatting bug? tmil@lle.rochester.edu
Multi-line formatting bug? milligan14414@my-dejanews.com
Re: Mysterious Perl Bug <jglascoe@giss.nasa.gov>
Re: not my server! (brian d foy)
Re: Perl 4 to Perl 5 Question (Clinton Pierce)
Re: Perl/Daemon (brian d foy)
Re: setting print defaults, question...? (Bart Lateur)
Re: TCGREP in Perl Cookbook (Greg Bacon)
Re: The truth about the Pentium III chip and ID --- **b <csteger@derivatech.com>
Re: Variables in QUERY_STRING (brian d foy)
Re: Why can't i create a file with >>$file? <pep_mico@hp.com>
Re: Why can't i create a file with >>$file? (Clinton Pierce)
writing thumnails horng@earthlink.net
Re: writing thumnails (brian d foy)
|| vs "or" <dwc3q@mamba.cs.Virginia.EDU>
Re: || vs "or" (Bart Lateur)
Re: || vs "or" <jeromeo@atrieva.com>
Re: || vs "or" <jglascoe@giss.nasa.gov>
Re: || vs "or" <dwc3q@mamba.cs.Virginia.EDU>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Mar 1999 15:44:30 -0500
From: anonymous <anonymous@anonymous.com>
Subject: converting hi-res time to system tics in Perl
Message-Id: <36F165AE.166C2AB5@anonymous.com>
I'm writing a program that needs to add and subtract times. I
originally thought that DateCalc could handle this but my times are
expressed down to the millisecond.
The one module on CPAN that gets down to this granularity is used for
timeing system commands.
Does anyone know of a module or function that can either convert a time
into system tics (and back) or add and subtract times that go down to
the millisecond?
Phil Johnson
Phil.Johnson@fmr.com
------------------------------
Date: Thu, 18 Mar 1999 14:31:45 -0600
From: Max Hartwig <mhartwig@lucent.MEOWcom>
Subject: Re: crypt DES and IDEA compile probs on Solaris 2.7
Message-Id: <36F162B1.2939B6CF@lucent.MEOWcom>
> I have the CPAN modules Crypt-DES and Crypt-IDEA. Both fail during
> make. I made some recommended changes to des.h that a user of an
> earlier version of solaris suggested (modified file below) which
> allowed DES to 'make' but it fails two tests on 'make test'.
I'm having similar problems, except, in addition, I can't get it to
'make'.So, please pass any information to me also. Remove "MEOW" from my
email address.
Max Hartwig
------------------------------
Date: Thu, 18 Mar 1999 16:22:43 GMT
From: John.Swainston@iclweb.com (John Swainston)
Subject: Determining GIf and JPG's dimensions
Message-Id: <36f12753.13657588@news1.icl.net>
Hi all,
I want to write a PERL script to determine the dimensions of
an image, so that I can restrict the size of images uploaded to a
site.
I have a vorking routine for GIFs, but I can't find the information to
determine the dimensions of JPGs.
I found one routine somewhere, but it doesn't seem to work. I would
like to do this in standard PERL, without having to spawn a 3rd party
App.
Anyone got any ideas.
Cheers,
John....
------------------------------
Date: 18 Mar 1999 19:47:10 GMT
From: nobody@dewpoint.eng.sun.com (Nobody)
Subject: Re: echo pwd
Message-Id: <7crl7u$5po$1@engnews2.Eng.Sun.COM>
In article <7cpdoa$asa$1@nnrp1.dejanews.com> mr_potato_head@my-dejanews.com writes:
>Hi,
> I need to echo the working directory to the screen and I tried using
>
>$directory = `pwd`;
#------
#Stick this part in here
#------
chomp($directory);
>print "$directory\n";
>
>But this doesn't work. Any ideas? Thanks in advance...
EDEW
------------------------------
Date: Thu, 18 Mar 1999 20:41:08 +0100
From: Pep Mico <pep_mico@hp.com>
Subject: Help translating an VbScript to PERL
Message-Id: <36F156D4.F791A3C3@hp.com>
Hello,
Can anybody help me translating this short Script to PERL
Dim fso, d, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvPath))
s = "Drive " & UCase(drvPath) & " - " s = s & d.VolumeName &
"<BR>"
s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0) s =
s & " Kbytes"
ShowFreeSpace = s
Basically I'm interested to know how I the first lines
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvPath))
Best Regards
pep_mico@hp.com
------------------------------
Date: 18 Mar 1999 19:48:30 GMT
From: nobody@dewpoint.eng.sun.com (Nobody)
Subject: Re: How to #! in Win95?
Message-Id: <7crlae$5pt$1@engnews2.Eng.Sun.COM>
In article <36f03235.9102999@news.telepac.pt> np49fn@mail.telepac.pt (Valter Cunha) writes:
>First of all, i want to say im a university student trying to learn
>scripting Perl by myself, with the help of several books. Right now i
>have one problem: all the books i read about Perl focus the scripting
>of Perl under Unix, but what about under Win95? Well, let us say i
>have a script called "test.pl" in the directory cgi-bin, and my perl
>interpreter file "perl.exe" is in the same directory... My problem is,
>im my html file, i have the following instruction:
>
><IMG SRC="cgi-bin\test.pl">
>
>and on my Perl script i start with the instruction "#!\cgi-bin\perl"
>the thing is... I cant get the script to get started... I even read
>the FAQ at www.perl.com, and they say "The Win95/NT installation, when
>using the Activeware port of Perl, will modify the Registry to
>associate the .pl extension with the perl interpreter. If you install
>another port, or (eventually) build
>your own Win95/NT Perl using WinGCC, then you'll have to modify the
>Registry yourself." Im novice at registry... Can someone help me?
>Thanxs
>
Try #!/cgi-bin/perl
Forward slashes will be properly interpreted on DOS systems.
EDEW
>Valter Cunha
>Abducted@mail.telepac.pt
------------------------------
Date: Thu, 18 Mar 1999 14:08:19 -0500
From: Elaine Ashton <elaine@cts.wustl.edu>
Subject: Re: Input for PERL Course request
Message-Id: <36F14F23.5BAE7FC@cts.wustl.edu>
"William D. Redman" wrote:
>
> I am working on putting together an introduction class for scripting in
> awk and PERL. The focus is for students that have already completed an
> introductory sequence that includes Bash scripting. They already
> understand programming structures. This course is to be an offering in
> IT, and within the System Administration concentration. I am looking
> forward to putting together some fun labs with SA tasks. I need some
> help starting out simply. What I am looking for is resources, besides
> CPAN, for material. I am an avid reader of the ORA's PERL books. I am
> looking for another training material source. Book review/suggestions
> would also be appreciated.
http://www.netaxs.com/~joc/perlbooks.html is possibly the best Perl book
review page I have seen out there. As an SA I am quite happy to see
someone putting together a class for System Administration as opposed to
covering the language itself since noone seems to do this (that I know
of). I had to pick Perl up as I used it...The three books I would
recommend would be (since many SA's already know C and sh) 'Perl in a
Nutshell', 'Effective Perl Programming' and the 'Perl Cookbook'. All
three are practical and get to the meat rather quickly, though I will
say that the Nutshell index could be much improved upon as it is scant
and somewhat useless. As far as awk goes, the ORA book is ok but nothing
that the man pages and a few on-line resources wouldn't cover. I think
any SA would appreciate a course that used concrete practical
applications of the language while learning. I don't see any Perl
books(yet) covering logrolling, back-ups, etc. all the bane and baliwick
of your friendly neighborhood BOFH :)
Enjoy.
e.
------------------------------
Date: Thu, 18 Mar 1999 20:14:14 GMT
From: tmil@lle.rochester.edu
Subject: Multi-line formatting bug?
Message-Id: <7crmqe$6dl$1@nnrp1.dejanews.com>
Hi,
whenever I use a multiline format and try to set the seperator($:)
to something other than whitespace it doesn't seen to work.
for example:
$:="\t";
$str1 = $temp1."\t".$temp2."\t".$temp3;
$str2 = $val1."\t".$val2."\t".$val3;
format STDOUT =
^<<<<<<<<<<<<< ^>>>>>>>>>>>>> ~~
$str1, $str2
.
This is what I expect:
Todd M. 1.22 V
Steve N. 34.0 ms
Taryn N. 222e-78
This is what I get
Todd M. Steve 1.22 V 34.0 m
N. Taryn N. s 222e-78
Why doesn't perl seem to pay attention to my break character($:)?
I'm using Perl 5.005-4 on Solaris 2.6.
Thanks,
Todd
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 20:12:34 GMT
From: milligan14414@my-dejanews.com
Subject: Multi-line formatting bug?
Message-Id: <7crmna$6d8$1@nnrp1.dejanews.com>
Hi,
whenever I use a multiline format and try to set the seperator($:)
to something other than whitespace it doesn't seen to work.
for example:
$:="\t";
$str1 = $temp1."\t".$temp2."\t".$temp3;
$str2 = $val1."\t".$val2."\t".$val3;
format STDOUT =
^<<<<<<<<<<<<< ^>>>>>>>>>>>>> ~~
$str1, $str2
.
This is what I expect:
Todd M. 1.22 V
Steve N. 34.0 ms
Taryn N. 222e-78
This is what I get
Todd M. Steve 1.22 V 34.0 m
N. Taryn N. s 222e-78
Why doesn't perl seem to pay attention to my break character($:)?
I'm using Perl 5.005-4 on Solaris 2.6.
Thanks,
Todd
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 14:56:02 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: cart@dansie.net
Subject: Re: Mysterious Perl Bug
Message-Id: <36F15A52.B2FB7431@giss.nasa.gov>
[courtesy copy of post sent to cited author]
Craig wrote:
>
> open(FILE,"$path");
check the return value of "open()":
open FILE, "< $path" or die "can't open file: $!";
Jay Glascoe
--
"Yes, you can think of almost everything as a function,
but this may upset your wife."
--Larry Wall
------------------------------
Date: Thu, 18 Mar 1999 15:33:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: not my server!
Message-Id: <comdog-ya02408000R1803991533370001@news.panix.com>
In article <7crbb9$45d$1@news.inet.tele.dk>, "Anders Prior" <b-olsen@post8.tele.dk> posted:
> Hi, How do I access a file placed on another server and read its contents?
> I'm new to Perl and I would like to show a part of another page on my page
> via CGI without having to place it in my server dir.
use LWP::Simple;
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 18 Mar 1999 19:40:48 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Perl 4 to Perl 5 Question
Message-Id: <36f653e0.704677182@news.ford.com>
[Poster cc'd in e-mail]
On Thu, 18 Mar 1999 13:42:48 -0500, "Andrew Weiss"
<aweiss@csdi.qualcomm.com> wrote:
>(1) Should I find a Perl4 and build it for W95/98? If so, where would I
>begin?
no. No. NO. *slap* *slap*
(Next on MST3K: "Perl4: The Language that Would Not Go Away")
>(3) Or, does anybody know of a program which can translate Perl4 to Perl5,
>or can point out what portions of the source may not work under Perl5?
There's no such program. But, there are hints. Get yourself a copy of
"Programming Perl, second edition" (It's got a blue cover--not pink).
Chapter 8 has some hints on things that will go wrong when you move from
Perl 4 to Perl 5. It's not a long list, and nothing is insurmountable.
>(2) Or, should I put the time in to find out why the application won't work
>under Perl5 (already spent a day at this, and getting frustrated) ?
YES. If you get really frustrated, post some code samples and the error
messages they're generating. But you should be able to figure them all
out based on what the Blue Camel tells you, and running the interpreter
with the "-w" warnings switch turned on will help.
--
Clinton A. Pierce "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org Miracles." -- Miracle Max, The Princess Bride
http://www.geeksalad.org
------------------------------
Date: Thu, 18 Mar 1999 15:34:44 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl/Daemon
Message-Id: <comdog-ya02408000R1803991534440001@news.panix.com>
In article <7crlbr$jsb$1@eipipeline.ei.org>, wweng@ei.org posted:
> Can I write a perl script and run it as a daemon?
yes. did you have a less general question about how to do it? there
are examples in the Camel book, btw.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 18 Mar 1999 20:35:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: setting print defaults, question...?
Message-Id: <36f26326.10778042@news.skynet.be>
Mike Eley wrote:
>i got this entire code from someone and don't
>know what the print defaults should be
>are they in reference to where i want the output file to be written? or
>something else?
> $,=" "; $\="\n"; # set some print defaults
Something else.
$,=" "; $\="\n";
@ary = (1,2,3);
print @ary;
print "Done";
=>
1 2 3
Done
$, is printed between the list elements that print() prints, and $\
terminates it.
Bart.
------------------------------
Date: 18 Mar 1999 20:10:57 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: TCGREP in Perl Cookbook
Message-Id: <7crmkh$gkb$1@info2.uah.edu>
In article <36f14e4f.12330049@news.bmc.com>,
christianarandaOUT@OUTyahoo.com (Christian M. Aranda) writes:
: In Tom Christiansen's version of grep (Recipe 6.22) in the Perl
: Cookbook, he has the following code:
PPT has produced a newer and better tcgrep.
<URL:http://language.perl.com/ppt/>
[...]
: getopts($optstring, \%opt) or usage();
[...]
: my question is this: when would it call usage()? I have written a
: hack of this for experimental use (i.e., it doesn't do anything
: practical yet).
getopts returns a false value when there is an error in the option
processing.
[snip code]
: This code does part of what I need. When invoked as 'mytest -v' it
: prints Version 0.01. When invoked as 'mytest' it doesn't do anything.
: I just can't seem to figure out when the 'or usage()' would fire.
Try running
% mytest -quux
Greg
--
UNIX should be used as an adjective.
-- AT&T
------------------------------
Date: Thu, 18 Mar 1999 20:31:07 GMT
From: Curt Steger <csteger@derivatech.com>
Subject: Re: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <36F161ED.C9F637C1@derivatech.com>
Quantum Leaper wrote:
> Michael Barnes wrote in message <36efc6e7.0@news.webaccess.net>...
> >Every MODEM has a MAC address also...so your friends pc is nicless, but not
> >macless
>
> Interesting is over 15 years of using modems, 300 baud to 56K modems
> (hopefully a Cable or DSL modem in about a year or so), I have NEVER heard
> that they have a MAC address? So what command or how do you get the MAC
> address of a modem? Does this only apply to Mac modems or all modems? One
> other question, why would a modem need a MAC address?
Only if it is running on an Apple/Mac!
Any here I thought that a MAC address was a special address book that Billy-bum
kept for retaliation if he ever took over the world. ?:^)
------------------------------
Date: Thu, 18 Mar 1999 15:32:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Variables in QUERY_STRING
Message-Id: <comdog-ya02408000R1803991532130001@news.panix.com>
In article <36f14e1f.33474352@news.enterprise.net>, jt@enterprise.net posted:
> Oh, for goodness sakes! Are you two so new to this list that you
> can't realise the PERL implications of the simplest query?
no, they are so experienced that they realize there are no Perl
implications. they're also pedantic to the point that they don't
know what "PERL" is, although they will talk to you about Perl or perl.
doesn't it seem to you that you can get better answers if you aren't
a jerk? i mean, you act like this in a face-to-face situation and
you could end up with a bloodied nose!
but maybe you're from New York.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 18 Mar 1999 21:09:13 +0100
From: Pep Mico <pep_mico@hp.com>
Subject: Re: Why can't i create a file with >>$file?
Message-Id: <36F15D69.3E5804F2@hp.com>
I've done a test under NT platform and it works correctly.
Do you have write permissions on target directory?
Poohba wrote:
> I am trying to append to a file and it won't append nor will it create the
> file if it isn't there. Why? I am using:
>
> $file = "file.dat";
> open (FILE, ">>$file") || die "Can't open $file: $!\n";
> print FILE "print all of this junk\n";
> close(FILE);
>
> I can't get it to open or append to file. Why?
>
> * Web Page Designs *
> / poohba@io.com | www.io.com/~poohba\
> ---------------------------------------
> \ For info about me send message with /
> * subject "send file help" *
>
------------------------------
Date: Thu, 18 Mar 1999 20:14:59 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Why can't i create a file with >>$file?
Message-Id: <36f85e31.707318930@news.ford.com>
[Poster cc'd in E-Mail]
On Thu, 18 Mar 1999 14:08:14 -0500, Poohba <poohba@io.com> wrote:
>I am trying to append to a file and it won't append nor will it create the
>file if it isn't there. Why? I am using:
>
>$file = "file.dat";
>open (FILE, ">>$file") || die "Can't open $file: $!\n";
>print FILE "print all of this junk\n";
>close(FILE);
>
>I can't get it to open or append to file. Why?
Of course you can't. That's Perl's job.
Is this code being reached at all? Is the die() reached? Does it print
an error? What's the error message? What version of perl are you
running? ("perl -v") Under what OS?
--
Clinton A. Pierce "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org Miracles." -- Miracle Max, The Princess Bride
http://www.geeksalad.org
------------------------------
Date: Thu, 18 Mar 1999 20:20:03 GMT
From: horng@earthlink.net
Subject: writing thumnails
Message-Id: <7crn5a$6ov$1@nnrp1.dejanews.com>
Hi,
I know perl can utilize the GD library to do some manipulation of gif files.
Is it possible to use perl to create thumnail image for a gif file? How
about any other format (jpg, bmp, tic, pic, etc)? Further, i would like to
generate the image with minimum file size. I know there are some well-known
software packages, eg. adobe imageready, can do that. I am looking for some
way to automate the entire process (creating thumnails then optimizing the
file size) with one call of perl script.
Are these all possible? I appreciate any advices.
R. Chiou
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 18 Mar 1999 15:42:20 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: writing thumnails
Message-Id: <comdog-ya02408000R1803991542200001@news.panix.com>
In article <7crn5a$6ov$1@nnrp1.dejanews.com>, horng@earthlink.net posted:
> I know perl can utilize the GD library to do some manipulation of gif files.
> Is it possible to use perl to create thumnail image for a gif file? How
> about any other format (jpg, bmp, tic, pic, etc)? Further, i would like to
> generate the image with minimum file size. I know there are some well-known
> software packages, eg. adobe imageready, can do that. I am looking for some
> way to automate the entire process (creating thumnails then optimizing the
> file size) with one call of perl script.
all of these are possible in several different ways. i like using
Perl::Magick which uses the ImageMagick stuff. it's available for
several platforms.
O'Reilly & Assocaites has a new book called "Programming Web Graphics
With Perl & GNU Software" by Shawn P. Wallace that talks extensively
about this sort of thing.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 18 Mar 1999 14:41:02 -0500
From: David Coppit <dwc3q@mamba.cs.Virginia.EDU>
Subject: || vs "or"
Message-Id: <Pine.GSO.4.05.9903181438550.27602-100000@mamba.cs.Virginia.EDU>
Why does the following print "1,"? I thought they were equivalent except
for precedence, and it doesn't seem like precedence is a factor here.
---------------------------
$a = '' || 1;
$b = '' or 2;
print "$a,$b\n";
---------------------------
David
_________________________________________________________________________
David Coppit - Graduate Student coppit@cs.virginia.edu
The University of Virginia http://www.cs.virginia.edu/~dwc3q
"Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."
------------------------------
Date: Thu, 18 Mar 1999 20:33:14 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: || vs "or"
Message-Id: <36f162b8.10668522@news.skynet.be>
David Coppit wrote:
>
>Why does the following print "1,"? I thought they were equivalent except
>for precedence, and it doesn't seem like precedence is a factor here.
>
>---------------------------
>$a = '' || 1;
>$b = '' or 2;
You must realize that "=" has a LOWER precedence than "or". So "$b = ''"
(that's false) makes "2" to be evaluated. Since there is no side effect,
nothing spectacular happens. $b is still an empty string.
Bart.
------------------------------
Date: Thu, 18 Mar 1999 12:26:31 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: David Coppit <dwc3q@mamba.cs.Virginia.EDU>
Subject: Re: || vs "or"
Message-Id: <36F16177.DADFAC65@atrieva.com>
David Coppit wrote:
>
> Why does the following print "1,"? I thought they were equivalent except
> for precedence, and it doesn't seem like precedence is a factor here.
>
> ---------------------------
> $a = '' || 1;
> $b = '' or 2;
>
> print "$a,$b\n";
> ---------------------------
Sure it does. From perlop:
Binary ``or'' returns the logical disjunction of the two surrounding
expressions. It's equivalent to || except for the very low precedence.
[SNIP]
This means that it short-circuits: i.e., the right expression is
evaluated only if the left expression is false. Due to its precedence,
you should probably avoid using this for assignment, only for control
flow.
$a = $b or $c; # bug: this is wrong
($a = $b) or $c; # really means this
$a = $b || $c; # better written this way
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Thu, 18 Mar 1999 15:37:41 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: David Coppit <dwc3q@mamba.cs.Virginia.EDU>
Subject: Re: || vs "or"
Message-Id: <36F16415.CD982D06@giss.nasa.gov>
[courtesy copy of post sent to cited author]
hi David,
David Coppit wrote:
>
> $a = '' || 1;
> $b = '' or 2;
Precedence; the above are equivalent to:
$a = ('' || 1);
($b = '') or 2;
Jay Glascoe
--
The software required "Windows 95 or better",
so I installed Linux.
------------------------------
Date: Thu, 18 Mar 1999 15:37:15 -0500
From: David Coppit <dwc3q@mamba.cs.Virginia.EDU>
Subject: Re: || vs "or"
Message-Id: <Pine.GSO.4.05.9903181531080.28423-100000@mamba.cs.Virginia.EDU>
On Thu, 18 Mar 1999, Jerome O'Neil wrote:
[snip]
> This means that it short-circuits: i.e., the right expression is
> evaluated only if the left expression is false. Due to its precedence,
> you should probably avoid using this for assignment, only for control
> flow.
They both short circuit.
> $a = $b or $c; # bug: this is wrong
> ($a = $b) or $c; # really means this
> $a = $b || $c; # better written this way
Ah! I forgot that = could actually have higher precedence than other
operators. Thanks!
David
_________________________________________________________________________
David Coppit - Graduate Student coppit@cs.virginia.edu
The University of Virginia http://www.cs.virginia.edu/~dwc3q
"Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5169
**************************************