[10577] in Perl-Users-Digest
Perl-Users Digest, Issue: 4169 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 6 18:07:49 1998
Date: Fri, 6 Nov 98 15:00:21 -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, 6 Nov 1998 Volume: 8 Number: 4169
Today's topics:
Re: $a = $a <rootbeer@teleport.com>
Re: $a = $a <rootbeer@teleport.com>
Re: ActiveX and Perl scott@softbase.com
Re: CGI and Server Loads <mcolbert@netgenics.knowspaaaamm.com>
Re: cgi.pm http socket example <sysop@scbbs.com>
Re: converting rfc822 files to MAPI messages ? scott@softbase.com
Re: creating a relocatable perl binary? <rootbeer@teleport.com>
Re: Help on version 4 and version 5... (Tad McClellan)
Re: IIS4, Perl, Object Moved <sysop@scbbs.com>
Re: Index of an element in a list? <rootbeer@teleport.com>
Re: Need a two way hash <r28629@email.sps.mot.com>
Re: OLE Sub routine scalar assignment problem <rootbeer@teleport.com>
Re: perl cgi tutorial <teampcs@yahoo.com>
Re: readdir bug in win95 perl 5.00402? <rootbeer@teleport.com>
Re: Shared CGI.pm from various directories <marks@webleicester.co.uk>
Re: Shared CGI.pm from various directories <rootbeer@teleport.com>
Re: Shared CGI.pm from various directories <rootbeer@teleport.com>
Re: Shared CGI.pm from various directories <rootbeer@teleport.com>
Re: shift in a list context <ludlow@us.ibm.com>
Re: shift in a list context <due@murray.fordham.edu>
Re: time question <r28629@email.sps.mot.com>
undef question <lccwgh@expl.aai.arco.com>
Re: undef question <rootbeer@teleport.com>
Re: what does split do on empty fields? <r28629@email.sps.mot.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 06 Nov 1998 22:27:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: $a = $a
Message-Id: <Pine.GSO.4.02A.9811061426180.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, Todd Smith wrote:
> if Perl saw this line, would it do some assignment or ignore it like
> it would a comment?
>
> $a = $a;
I don't think the peephole optimizer is (or should be) clever enough to
optimize that out of existence. After all, we have to leave something for
the programmer to do. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 22:33:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: $a = $a
Message-Id: <Pine.GSO.4.02A.9811061427360.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, Justin B. Harvey wrote:
> It would also fail if you're using strict and you haven't defined $a,
> but that's neither here or there :>
Did you mean define or declare? A scalar variable is defined in Perl if it
has any value other than undef, but that's not required to do an
assignment whether 'use strict' is in force or not.
I think you're thinking of 'use strict "vars"', and meaning that $a has to
be declared. That turns out not to be the case: $a need not be declared,
even under 'use strict "vars"', because it's one of Perl's internal
variables, like @ARGV or %INC. $a and $b are used by Perl in sort.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 6 Nov 1998 23:27:23 GMT
From: scott@softbase.com
Subject: Re: ActiveX and Perl
Message-Id: <364385db.0@news.new-era.net>
Roger Kenneth Trussell (rtrussell@hps-inc.com) wrote:
> Hello Everyone,
> I'm sorry to bug everyone with a seemingly stupid question but...
> Does anyone know whether there exist a version of Perl for Windows
> 95/95/NT that can access ActiveX objects? I've already heard about ActiveX
> scripting engines, but I don't think that is what I want. I want to write a
> CGI-BIN script that can access ActiveX objects located on the server.
If you mean Automation components, you can use the Win32::OLE module.
Scott
------------------------------
Date: Fri, 06 Nov 1998 22:39:04 GMT
From: MBC <mcolbert@netgenics.knowspaaaamm.com>
Subject: Re: CGI and Server Loads
Message-Id: <36438943.B231A43C@netgenics.knowspaaaamm.com>
Justin B. Harvey wrote:
> So less efficient means slower? If so, not according to the mod_perl
> stuff on CPAN:
>
> > Using mod_perl and Apache::Registry requires you to be
> > more careful, but it also gives new meaning to the work "quick"!
>
> j
>
i think *you're* pretty "quick"! ;-)
> MBC wrote:
> >
> > no! mod_perl was designed specifically to make your web server LESS
> > efficient, therefore INCREASING your server load. seriously though,
> > mod_perl is an apache module, not a perl module. you should check with a
> > group that talks about apache. :-)
> >
> > gabriel@communitech.net wrote:
> >
> > > Does anyone have any experience with the effect of mod_perl
> > > on the server loads, especially if the server is handling quite
> > > alot of CGI processes?
> > >
> > > Our server loads are significant and it appears that mod_perl
> > > is the answer. Theoretically, it should help with the load
> > > averages. Can anyone speak for it in practice?
> > >
> > > Does mod_perl make CGI run more efficiently and reduce the
> > > server load averages?
> > >
> > > Any feedback is appreciated.
> > >
> > > -----------== Posted via Deja News, The Discussion Network ==----------
> > > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 06 Nov 1998 22:23:04 GMT
From: Ron Parker <sysop@scbbs.com>
Subject: Re: cgi.pm http socket example
Message-Id: <364376C8.AF755806@scbbs.com>
You are absolutely right. It took a few hours to download, install, and debug
everything, but the program now works as intended. All that work, and all that was
required, once modules were installed, was one line!
Thanks very much.
-ron
Tony Curtis wrote:
> Re: cgi.pm http socket example, Ron <sysop@scbbs.com> said:
>
> Ron> I have downloaded the CGI.PM Perl 5 Library, the CPAN
> Ron> Perl CGI Programming FAQ and Perl Reference Page, and
> Ron> searched www.dejanews.com, but still cannot find an
> Ron> example of how to use the cgi.pm package to write a
> Ron> script to connect to a www server, send a POST or GET
> Ron> request, and print the resulting page.
>
> That's because this has nothing to do with CGI.pm
>
> Ron> Can someone point me to a location where I can find
> Ron> this particular script, or past it into a reply? I'd
> Ron> really appreciate it. Currently, I am using a script
> Ron> which utilizes cgi-lib.pl, http-lib.pl, and the
> Ron> Socket.pm package, but it is causing an "Object Moved"
> Ron> error when used to call a IIS4 server. I want to try
> Ron> using a cgi.pm script to see if there is a difference.
>
> You want the LWP modules.
>
> hth
> tony
> --
> Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
> Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
> "You see? You see? Your stupid minds! | private email:
> Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
--
Ron Parker
TradePoint LA / Tradewinds / SCBBS
www.intl-trade.com
www.tradepointla.org
www.scbbs.com
------------------------------
Date: 6 Nov 1998 23:31:03 GMT
From: scott@softbase.com
Subject: Re: converting rfc822 files to MAPI messages ?
Message-Id: <364386b7.0@news.new-era.net>
muzo (muzok@nospam.pacbell.net) wrote:
> a MAPI object (which is accessible through OLE automation)
I've played with MAPI some using Automation, and you are *NOT* going to
enjoy it. No two verions of any Microsoft e-mail clients implement the
MAPI interface in the same way. Some stuff works, some stuff doesn't,
and none of it is documented.
Scott
------------------------------
Date: Fri, 06 Nov 1998 22:10:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: creating a relocatable perl binary?
Message-Id: <Pine.GSO.4.02A.9811061402300.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, Stephen Riehm wrote:
> Perl has but one drawback - it's not delivered with commercial *nixen
> yet.
s/with/with all/;
> We have started delivering perl scripts with our products, which
> means we also need to be able to deliver perl to the customers.
Naw; just sell them "perl installation services" at $150/hour. That's what
I do, but I charge more when I can get away with it. :-)
> The problem is that the machines we install our software on don't have
> compilers, and their managers are very picky about what software goes
> where, meaning we have to recompile perl and install the modules we
> need again and again and again..... - there must be a better way :-)
If the machines are sufficiently identical, make a tarball on the first
one.
> So, what I'ld really like to do is compile perl in such a way that
> the @INC path's etc aren't hardcoded, but instead that the location
> of the perl binary be induced from $0,
That won't work, in general. There's no general way on Unix systems to
identify the "real name" of the program currently running. It could be
that you'll get the wrong location sometimes.
> and @INC set relative to that.
Better method: Start each script with 'use StephenRiehm::Configure;', then
let that module set @INC and anything else you need. Then you need only
adjust that simple module for each variant installation. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 5 Nov 1998 22:20:32 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help on version 4 and version 5...
Message-Id: <gett17.am5.ln@flash.net>
Rusty Williamson (rwilliamson@uno.gers.com) wrote:
: I've hit a little problem -- on the dozen or so servers we have at work,
: /usr/bin/perl on some systems is version 5, while on others its version 4
: and version 5 is /usr/bin/perl5. We have tons of v4 scripts all starting
: out with #!/usr/bin/perl. What are people doing?
They are upgrading their perls ;-)
Windows 3.1 was the predominant (so called) Operating System
on PCs when perl 4 was current.
You mention "servers". If that is as in "HTTP servers", then
you ought to know that your system is vulnerable to crackers.
There is a CERT notice for perls < 5.004.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 06 Nov 1998 22:18:04 GMT
From: Ron Parker <sysop@scbbs.com>
Subject: Re: IIS4, Perl, Object Moved
Message-Id: <36437596.840F1955@scbbs.com>
Hi Steve. Thanks for your assistance here. I found a note regarding the LWP
package. Several hours later, after downloading, installing, debugging, testing,
etc..., I discovered my problem -- I was using the wrong tools!
Now, I just use two lines:
$content = get("http://whatever.com");
print $content;
...and I'm done. The only reason I use the two lines is because I do some parsing on
"$content" before printing it.
Thanks so much for the assistance. I'm posting this to the newsgroup also in case it
might help someone else.
Having problems with socket scripts to IIS4 server? Get LWP from www.perl.com.
Steve Kilbane wrote:
> [ Copy emailed ]
>
> In article <3642B4FE.C3A040B7@scbbs.com>, Ron Parker <sysop@scbbs.com> writes:
> > IIS is returning the "Object Moved" message as a reponse to the "POST" request
> > sent by the script.
>
> Ok.
>
> > The URL in the POST request is correct. A similar program works on another Unix
> > machine running an older NCSA www server and Perl 4.x.
>
> Be specific here. Let's say your browser is on machine B, your Apache server
> on machine U (unix) and IIS on machine W (windows). This other server - would
> that be an alternative to W that U can talk to, or an alternative to U that can
> talk to W?
>
> > The only difference
> > between the two is that Perl 5.x requires that I print the header "Content Type:
> > text/html" before processing the POST request and Perl 4.x does not.
>
> Well, this doesn't make sense. Perl 5 doesn't have any requirements at all,
> but if your server (U?) sees any output that doesn't look like a header, before
> the header is closed, it'll barf. Perl 5 might just be generating a warning about
> your script.
>
> > If I do print
> > it, the IIS response to the POST request is "Object Moved". Any ideas?
>
> Which status code are you giving in your response header on the Windows
> machine? Is it a plain 200, or are you not specifying? I've seen IIS completely
> ignore the response provided, because it decided that it knew how to handle
> the status code itself...
>
> Also, are you including Location: or URL: headers in your response? Those
> will cause IIS to decide that what you *really* meant was that the object
> had moved...
>
> steve
> --
> <Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
> IIS4+Perl5 FAQ: http://www.whitecrow.demon.co.uk/steve/iis4.html
--
Ron Parker
TradePoint LA / Tradewinds / SCBBS
www.intl-trade.com
www.tradepointla.org
www.scbbs.com
------------------------------
Date: Fri, 06 Nov 1998 22:37:44 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Index of an element in a list?
Message-Id: <Pine.GSO.4.02A.9811061437230.20411-100000@user2.teleport.com>
On 6 Nov 1998, Awrobinson wrote:
> Is there a built-in or effiecient way to determine the index of an
> element in a list?
Have you seen what the FAQ says about this? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 16:21:10 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Awrobinson <awrobinson@aol.com>
Subject: Re: Need a two way hash
Message-Id: <36437656.A75F8093@email.sps.mot.com>
[posted to comp.lang.perl.misc and copy emailed]
Awrobinson wrote:
>
> I'm building an application where I have two quantities matched up. In some
> cases, I need to use one set as the key to the other. In other cases, I need to
> use the second set as the key to the first. Can anyone suggest a convenient way
> to do this? Is there a way to use the values in a hash to get to the keys?
>
> TIA...
assuming all keys and values are uniq among their respective field, use
reverse() :
DB<39> %hash = (a=>1, b=>2)
DB<40> %rhash = reverse %hash
DB<41> x \%rhash
0 HASH(0x400e96b4)
1 => 'a'
2 => 'b'
DB<42> x \%hash
0 HASH(0x400e9624)
'a' => 1
'b' => 2
A hash is just a special kind of list.
-tk
------------------------------
Date: Fri, 06 Nov 1998 22:01:05 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: OLE Sub routine scalar assignment problem
Message-Id: <Pine.GSO.4.02A.9811061359070.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, John Hardy wrote:
> The problem I am having below is when the script reaches:
> $CMD->ActiveConnection=$Conn;
>
> PERL complains "Can't modify subroutine entry in Scalar assignment at
> line 95 near "$Conn;" "
>
> I don't understand??
Have you seen what perldiag says about this message?
> Can anyone tell me the proper way to do this??
I'm sure someone can. Just what is it that you're trying to do? Is it
covered in the docs for the module you're using? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 6 Nov 1998 14:23:51 -0800
From: "Martin P" <teampcs@yahoo.com>
Subject: Re: perl cgi tutorial
Message-Id: <3643773e.0@news-in.pcmagic.net>
Hello,
I have read numerous programming books (many languages) and found one on
Perl that is very easy to understand compared to all others. The author is
"Jerry Muelver" and the book is "Creating Cool Web Pages With Perl",
published by IDG Books. Ya, the title is silly, but this book covers a wide
range of Perl and when you are finished you will be construction scripts
form scratch.
Good luck
Martin P
John Spyrou wrote in message <71u9mk$39d$1@ns1.otenet.gr>...
>I have downloaded perl for windows and I am a linux user too. I have found
>some cgi scripts writen in perl but I really dont know the language.
>So I would be pleased if someone could tell me a good
>perl tutorial and if it is about cgi programming too it will be great.
>Can I find tutorials for both sublects somewhere ?
>
>thanx in advance
>George Statis
>
>
>
------------------------------
Date: Fri, 06 Nov 1998 22:15:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: readdir bug in win95 perl 5.00402?
Message-Id: <Pine.GSO.4.02A.9811061413301.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, Dan Baker wrote:
> The problem is that I'm using readdir to grab a listing of a
> directory, and the attributes of the items doesn't seem to be getting
> read correctly if I opendir() anywhere other than the current working
> dir where the test script is being executed.
If you're asking for -d 'fred', you're talking about fred in the current
directory, of course. If you mean -d '/some/other/dir/fred', say so. Hope
this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 22:13:47 +0000
From: Mark Simonetti <marks@webleicester.co.uk>
Subject: Re: Shared CGI.pm from various directories
Message-Id: <3643749B.10B5F424@webleicester.co.uk>
Really if you have the module "installed" properly, it should already be in perls
"path", ie, in the @INC array, which contains search paths for modules. Print out
@INC in perl if you want to see. The better way to make a perl scripts always
check a certain path is to simply add it to this array at the start, thus:
push(@INC, /somepath/somepath/blah/blah);
use CGI;
Hope this makes sense.
Mark.
--
"Justin B. Harvey" wrote:
> One way to do it...
>
> Let's say CGI.pm is located in /home/bilbo/lib/perl/CGI.pm, you could in
> every script:
>
> use '/home/bilbo/lib/perl';
> use CGI;
>
> Voila, it should work. Also for running stuff outta command line you
> can setenv PERLLIB /home/bilbo/lib/perl. When downloading modules you
> can run their makefiles and install them into your lib directory by:
>
> perl Makefile.PL PREFIX=/home/bilbo/ INSTALLSITELIB=/home/bilbo/lib/perl
>
> bill_mcintyre@my-dejanews.com wrote:
> >
> > I know this is probably simple but I have a brain lock on it.
> >
> > i have quite a few scripts that use the CGI.pm module. To increase security
> > and orderliness I have created subdirectories in CGI-BIN to store different
> > types of scripts. My problem is that I can't figure out how to call CGI.pm
> > from different locations. When I "USE CGI" CGI.pm seems to only work in the
> > same directory as the script that is calling it. How can I have just one copy
> > of CGI.pm and call it from differnet scripts in differnet directories.
> >
> > TIA.
> >
> > Bill McIntyre (bill_mcintyre@hotmail.com)
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 06 Nov 1998 22:20:59 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Shared CGI.pm from various directories
Message-Id: <Pine.GSO.4.02A.9811061420240.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, Mark Simonetti wrote:
> push(@INC, /somepath/somepath/blah/blah);
> use CGI;
What happened when you tried this before posting. Ouch!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 22:20:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Shared CGI.pm from various directories
Message-Id: <Pine.GSO.4.02A.9811061419210.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, Justin B. Harvey wrote:
> Let's say CGI.pm is located in /home/bilbo/lib/perl/CGI.pm, you could in
> every script:
>
> use '/home/bilbo/lib/perl';
> use CGI;
No, that's not right. Maybe you left out a word? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 22:23:16 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Shared CGI.pm from various directories
Message-Id: <Pine.GSO.4.02A.9811061421110.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998 bill_mcintyre@my-dejanews.com wrote:
> When I "USE CGI" CGI.pm seems to only work in the same directory as
> the script that is calling it. How can I have just one copy of CGI.pm
> and call it from differnet scripts in differnet directories.
Good answer: Use 'use lib' properly and you can tell perl where to find
your module.
Better answer: Put the CGI module with your other modules, along the
existing @INC path.
Best answer: Install 5.004 or later properly, and this problem (and
others) will go away.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 15:59:34 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: shift in a list context
Message-Id: <36437146.C2A31B88@us.ibm.com>
Awrobinson wrote:
>
> I haven't seen this stated anywhere, so I thought I would ask. Can I use a
> single shift() operation to retrieve more than one element? If I coded
> something like:
>
> sub mysub {
> ( $first, $second ) = shift;
>
> would I get the first two elements of @_?
splice
The Perl Cookbook gives a pretty slick example of this. From 4.11:
sub shift2 (\@) {
return splice(@{$_[0]}, 0, 2);
}
Then you could do something like
($a, $b) = shift2(@array);
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: 6 Nov 1998 22:10:12 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: shift in a list context
Message-Id: <71vs44$imt$0@206.165.167.213>
Sean McAfee wrote in message ...
>In article <19981106163344.12673.00000190@ng14.aol.com>,
>Awrobinson <awrobinson@aol.com> wrote:
>>I haven't seen this stated anywhere, so I thought I would ask. Can I use a
>>single shift() operation to retrieve more than one element? If I coded
>>something like:
>
>> sub mysub {
>> ( $first, $second ) = shift;
>
>>would I get the first two elements of @_?
>
>Empiricism is dead, it seems...
ROTFL, twice in one day. The other was when I was backtracking and read a
response from brian d foy in which he responded to a question of similar
intellectual inquisitiveness:
Don't guess, this isn't sociology.
Maybe its just because its Friday and I am way loopy. They are going in my
quote file none the less.
AmD
------------------------------
Date: Fri, 06 Nov 1998 15:28:54 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: cadman <cadman@tikipub.com>
Subject: Re: time question
Message-Id: <36436A16.B6D0E34@email.sps.mot.com>
[posted to comp.lang.perl.misc and copy emailed]
cadman wrote:
>
> How can I get "Wed Oct 21 15:00:30 1998" into the time format in perl?
> So that it will show the above date as an integer number of seconds past
> midnight GMT, January 1, 1970.
if you want a solution with getting too involved with the hassle, this
might help:
$now = time; # elapsed time in seconds since...
$formated = localtime($now); # eg. Wed Oct 21 15:00:30 1998
@struct_tm = localtime($now); # in sec, min....
I personally find more managable to keep track of only the $now var, and
do the necessary conversion when needed.
-tk
------------------------------
Date: Fri, 6 Nov 1998 21:45:54 GMT
From: "William G. Hersman" <lccwgh@expl.aai.arco.com>
Subject: undef question
Message-Id: <36436E12.DA6E712A@expl.aai.arco.com>
--------------93A70938D07C24934E2B81C2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Why is this:
undef(@a,@b,@c);
not the same as this:
undef(@a);
undef(@b);
undef(@c);
???
The first line does not, in fact, clear out the arrays.
Thanks.
--
\\\\\//
| |
(.) (.)
==========oOO==(_)==OOo===============================================
Willy
x6405
lccwgh@expl.aai.arco.com
============( )-___=================================================
\ ( ( )
\_) ) /
(_/
--------------93A70938D07C24934E2B81C2
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<PRE>Why is this:</PRE>
<PRE>undef(@a,@b,@c);</PRE>
<PRE>not the same as this:</PRE>
<PRE>undef(@a);</PRE>
<PRE>undef(@b);</PRE>
<PRE>undef(@c);</PRE>
<PRE>???</PRE>
<PRE>The first line does not, in fact, clear out the arrays.</PRE>
<PRE></PRE>
<PRE>Thanks.</PRE>
<PRE>--
\\\\\//
| |
(.) (.)
==========oOO==(_)==OOo===============================================
Willy
x6405
lccwgh@expl.aai.arco.com
============( )-___=================================================
\ ( ( )
\_) ) /
(_/</PRE>
</HTML>
--------------93A70938D07C24934E2B81C2--
------------------------------
Date: Fri, 06 Nov 1998 22:52:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: undef question
Message-Id: <Pine.GSO.4.02A.9811061450240.20411-100000@user2.teleport.com>
On Fri, 6 Nov 1998, William G. Hersman wrote:
> Why is this:
>
> undef(@a,@b,@c);
A bug in the early implementation of undef(), and fixing it completely may
break some old programs, alas. Fortunately, Perl's -w warnings will point
this bad code out to you. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 06 Nov 1998 16:11:06 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: what does split do on empty fields?
Message-Id: <364373FA.481740CC@email.sps.mot.com>
[posted to comp.lang.perl.misc and copy emailed]
Eric The Read wrote:
[...]
> The problem is, not all lines have fields 21 and 22 defined-- they just have:
>
> "[20 fields]|||[some more fields]" or
> "[20 fields]|1998/11/05||[some more fields]" or
> "[20 fields]||1998/11/05|[some more fields]"
>
> in them. That's fine-- if there's nothing there, I don't need to convert
> anything, so I want to skip that field.
>
> I separate out the fields by doing
>
> @tmp = split /\|/;
DB<37> @tmp = split /\|/, "[20 fields]||1998/11/05|[some more fields]"
DB<38> x \@tmp
0 ARRAY(0x40138124)
0 '[20 fields]'
1 '' <----- empty field, but still 'defined'
2 '1998/11/05' <----- this is what you want, see, it works
3 '[some more fields]'
> My question is, what does "split" do if the value between the split
> characters is empty? I've tried testing
>
> if(defined $tmp[21])
First, you are testing the wrong field. Field #21 is $tmp[20]. Remember,
first element is [0], unless you messed with $[ variable. you haven't,
have you?
Second, '' is still defined (perldoc -f defined), so..
print 'empty' if defined $tmp[1]; #print: empty
print $tmp[2] if $tmp[2]; #print: 1998/11/05
Have fun.
-tk
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4169
**************************************