[21699] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3903 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 2 18:06:03 2002

Date: Wed, 2 Oct 2002 15:05:21 -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           Wed, 2 Oct 2002     Volume: 10 Number: 3903

Today's topics:
    Re: A simple form problem! <wsegrave@mindspring.com>
    Re: A simple form problem! <jurgenex@hotmail.com>
    Re: A simple form problem! <wsegrave@mindspring.com>
    Re: A simple form problem! <wsegrave@mindspring.com>
    Re: chdir then changing back <rgarciasuarez@free.fr>
        code for loading and copying Web Pages <aolsz@bellatlantic.net>
    Re: code for loading and copying Web Pages <mike_constant@yahoo.com>
    Re: Convert Perl script to C program (and Why was this  <Cptn.Fredo@S.S.No.Spam>
        e-mail in perl <g-preston1@ti.com>
    Re: Help needed to write calendar application <dha@panix2.panix.com>
    Re: How can I count files in a directory? <mike_constant@yahoo.com>
        How to geta list of perl modules <barryk2@delete_me.mts.net>
    Re: How to geta list of perl modules <mike_constant@yahoo.com>
    Re: How to geta list of perl modules <nobody@nowhere.com>
        html::treebuilder <dfinney@cts.com>
    Re: Mac OS X and Perl 6 (Randal L. Schwartz)
    Re: Mac OS X and Perl 6 <rgarciasuarez@free.fr>
    Re: Mac OS X and Perl 6 <heather710101@yahoo.com>
    Re: Mac OS X and Perl 6 <tom.beer@btfinancialgroup.spamfilter.com>
    Re: New Perl Module for QA Engineers <comdog@panix.com>
        newbie fine-tune first program mod_perl <nuba@dcc.ufmg.br>
        numbers & strings again (and again and again) <penny1482@attbi.com>
        Odd behavior for variables "a" and "b" (Tom Ewall)
    Re: Odd behavior for variables "a" and "b" (Walter Roberson)
        Perl script stops with the following message?? (John)
    Re: Perl script stops with the following message?? <bart.lateur@pandora.be>
    Re: Perl script stops with the following message?? (Walter Roberson)
    Re: Perl script stops with the following message?? <bart.lateur@pandora.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 2 Oct 2002 14:03:11 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: A simple form problem!
Message-Id: <anfg02$ugu$1@nntp9.atl.mindspring.net>

"Simon Harvey" <ReplyToGroup@thanks.com> wrote in message
news:Shom9.11757$J47.1041932@stones...
<snip>
>The only way I know
> how to get form data is if I know the name in advance, then I can use the
> param function in the CGI package.

You do need to know the names in advance. Of course, if you are the
originator of the form, you should know the names in advance. See script
below.

>That's nice and easy but obviously I
cant
> right 25 param statements to make sure i get all the check boxes!
>
> How would you go about handling this sort of situation?
>

What is obvious is that you wish to avoid the labor of writing 25 param
statements. ;-)

Seriously, you COULD let Perl write them for you, if you MUST have them.
Referring to the script below:

I see you're likely using Windows, so the following works with IndigoPerl,
available free from www.indigostar.com.

#!perl -w
# echo2htm.pl - echos name=value pairs as HTML
use strict;
use CGI qw(-no_xhtml :standard *pre);
print header, start_html, start_pre;
foreach (param()) {print $_, '=', param($_), "\n"}
print end_pre, end_html;

The foreach statement prints a list of the name=value pairs submitted to the
script, regardless of the number of form fields. If you need to use such a
script to produce a more complex list, e.g., SQL statement or cgiemail
template, the above print statements can be modified to suit, as follows:

foreach (param()) {
    print
        "front_stuff",
        $_,
        "middle_stuff",
        param($_),
        "back_stuff"
}

Use single or double quotes as appropriate with *_stuff, or none at all, if
you've packaged the instances of *_stuff as subroutines in a module.

If you just wish to use the script from the command line, just comment out
the 1st and 3rd print statements, i.e., before and after the foreach
statement.

Bill Segraves










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

Date: Wed, 2 Oct 2002 12:13:58 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: A simple form problem!
Message-Id: <3d9b4576$1@news.microsoft.com>

William Alexander Segraves wrote:
> "Simon Harvey" <ReplyToGroup@thanks.com> wrote in message
> news:Shom9.11757$J47.1041932@stones...
> <snip>
>> The only way I know
>> how to get form data is if I know the name in advance, then I can
>> use the param function in the CGI package.
>
> You do need to know the names in advance.

Why? Does
             @names = $query->param
not give you the names?

jue




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

Date: Wed, 2 Oct 2002 14:28:23 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: A simple form problem!
Message-Id: <anfhqv$504$1@slb6.atl.mindspring.net>

"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:3d9b4576$1@news.microsoft.com...
> William Alexander Segraves wrote:
> > "Simon Harvey" <ReplyToGroup@thanks.com> wrote in message
> > news:Shom9.11757$J47.1041932@stones...
> > <snip>
> >> The only way I know
> >> how to get form data is if I know the name in advance, then I can
> >> use the param function in the CGI package.
> >

Correction in square brackets:

> > You do [not] need to know the names in advance.
>
> Why? Does
>              @names = $query->param
> not give you the names?

Yes, but I didn't see any need for creating an additional array. You'll see
I used param() to get the names, e.g.,

foreach (param()) {print $_, '=', param($_), "\n"}

Thanks, Jue.

I meant to write "You do NOT need to know the names in advance."

I missed the typo in proofreading before sending. It should be obvious to a
reader competent with Perl and CGI.pm that the script I presented does not
require any advance knowledge of the names.

ATB.

Bill Segraves






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

Date: Wed, 2 Oct 2002 14:36:19 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: A simple form problem!
Message-Id: <anfhr0$504$2@slb6.atl.mindspring.net>

"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:anfg02$ugu$1@nntp9.atl.mindspring.net...
> "Simon Harvey" <ReplyToGroup@thanks.com> wrote in message
> news:Shom9.11757$J47.1041932@stones...

<snip>

Please ignore previous post. Re-posted to correct typo in second paragraph
below:

"You do need ..."

should be read as

"You do _not_ need ..."

<snip>
>The only way I know
> how to get form data is if I know the name in advance, then I can use the
> param function in the CGI package.

You do _not_ need to know the names in advance. Of course, if you are the
originator of the form, you should know the names in advance. See script
below.

>That's nice and easy but obviously I
cant
> right 25 param statements to make sure i get all the check boxes!
>
> How would you go about handling this sort of situation?
>

What is obvious is that you wish to avoid the labor of writing 25 param
statements. ;-)

Seriously, you COULD let Perl write them for you, if you MUST have them.
Referring to the script below:

I see you're likely using Windows, so the following works with IndigoPerl,
available free from www.indigostar.com.

#!perl -w
# echo2htm.pl - echos name=value pairs as HTML
use strict;
use CGI qw(-no_xhtml :standard *pre);
print header, start_html, start_pre;
foreach (param()) {print $_, '=', param($_), "\n"}
print end_pre, end_html;

The foreach statement prints a list of the name=value pairs submitted to the
script, regardless of the number of form fields. If you need to use such a
script to produce a more complex list, e.g., SQL statement or cgiemail
template, the above print statements can be modified to suit, as follows:

foreach (param()) {
    print
        "front_stuff",
        $_,
        "middle_stuff",
        param($_),
        "back_stuff"
}

Use single or double quotes as appropriate with *_stuff, or none at all, if
you've packaged the instances of *_stuff as subroutines in a module.

If you just wish to use the script from the command line, just comment out
the 1st and 3rd print statements, i.e., before and after the foreach
statement.

Bill Segraves





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

Date: 02 Oct 2002 20:19:46 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: chdir then changing back
Message-Id: <slrnapml9t.dl7.rgarciasuarez@rafael.example.com>

Helgi Briem wrote in comp.lang.perl.misc :
> On Wed, 02 Oct 2002 03:19:37 GMT, tadmc@augustmail.com (Tad
> McClellan) wrote:
> 
>>[1] But you wouldn't put it immediately after the chdir()
>>    call, because you need to check its return value :-)
>>
>>   chdir "../.." or die "could not back up two levels";
> 
> I would make that:
> chdir "../.." or die "could not back up two levels:$!";
> because I think the return value is contained in $!.

$! would be the system's error message. The return value of chdir is a
good'ol boolean value.

> On the other hand, and this is a personal idiosyncracy
> of mine, I never chdir within a Perl program unless
> an external program I am using requires that it be
> started in some particular location.

But modules you use can do this. File::Find, for example.

BTW nobody mentioned File::chdir yet.


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

Date: Wed, 02 Oct 2002 21:59:36 GMT
From: GET NJ <aolsz@bellatlantic.net>
Subject: code for loading and copying Web Pages
Message-Id: <3D9B6C4C.64D09D8@bellatlantic.net>

Can anybody suggest a reference to code for loading a Web Page (from a
remote server) and copying/saving the Page?

Clearly any few Pages can be saved manually within a broswer.  I'm
looking for a way to save thousands of Pages that are numbered
sequentially.  I'm figgering on nesting the code.

Thank you.

--

GET NJ
Free Ads -- AND LOTS MORE!
http://www.getnj.com




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

Date: Wed, 2 Oct 2002 15:03:27 -0700
From: "Newbie" <mike_constant@yahoo.com>
Subject: Re: code for loading and copying Web Pages
Message-Id: <anfqg9$ds2d3$1@ID-161864.news.dfncis.de>


"GET NJ" <aolsz@bellatlantic.net> wrote in message
news:3D9B6C4C.64D09D8@bellatlantic.net...
> Can anybody suggest a reference to code for loading a Web Page (from a
> remote server) and copying/saving the Page?
>
> Clearly any few Pages can be saved manually within a broswer.  I'm
> looking for a way to save thousands of Pages that are numbered
> sequentially.  I'm figgering on nesting the code.
>
> Thank you.

Check out LWP package. What you want is sending a http request, getting
response and saving.




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

Date: Wed, 02 Oct 2002 19:53:48 GMT
From: ".Fredo" <Cptn.Fredo@S.S.No.Spam>
Subject: Re: Convert Perl script to C program (and Why was this group's name changed?)
Message-Id: <g9Im9.276$3r2.2422851@newssvr21.news.prodigy.com>


"Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in
message news:slrnapl76h.1bi.bernard.el-hagin@gdndev25.lido-tech...
> In article <rhpm9.980$Ry1.113925375@newssvr14.news.prodigy.com>,
> .Fredo wrote:
> >
> > "Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
> > news:Pine.LNX.4.40.0210012321240.4865-100000@lxplus074.cern.ch...
> >>
> >> On Oct 1, .Fredo replied to Tad:
> >>
> >> [far too much for comfort]
> >>
> >> > > Do you see any irony there?
> >> >
> >> > Not really. In your short little reply, you had little to offer,
but
> > a
> >> > misleading reply (to the OP mainly). I seemed like just another
one
> > of
> >> > your rude posts, and you ending here does little persuade
otherwise.
> >>
> >> I could see this coming.  A well-earned killfile entry.  Please
> >> don't change your posting address.
> >
> > As usual you happen to perfectly avoid the issue, that happens spans
way
> > passed what you quoted. Actually you've put a new low on "little to
> > offer". But then again, you, Tad are saint, rgiht? Sorry I forgot.
>
>
> Do you not understand the concept of a killfile? Neither Tad nor Alan
> can see your replies, so why bother?

So they would have you think. It doesn't take a complete genius to
figure out how to get around those. They need to be taught you just
cannot "plonk" a person and hope that wins the argument. A killfile in
it's self is not a bad thing, but the way it's commonly (mis)used to
cheaply get the last word (especially if the plonker is wrong).

Over recent years, it has become a straight fact the Tad. To deny what
has been going on here for the past years is to deny history.

No one, not even a revered book author, nor an expert programmer, has no
right to display such rudeness when ever they see fit. This is what has
been going on. I have been corresponding via email with various folk
from this group for well over a year now, and this feeling not only felt
by myself.




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

Date: Wed, 2 Oct 2002 15:53:26 -0500
From: "Jerry Preston" <g-preston1@ti.com>
Subject: e-mail in perl
Message-Id: <anfmc8$lh9$1@tilde.itg.ti.com>

Hi!

I need to be able to read incoming e-mail break down it's contents, input

this data into an oracle table, do some numbers based on this data. Then

generate a new e-mail and send it back.

The only part that is new to me here is the e-mail. What is the best and or

easiest way to deal with e-mail and to get started? I have seen comments

based on CPAN, Net::SMTP, MIME, Net::POP3 etc.

What do I need to read?  Where can IO find some examples?

Thanks,

Jerry




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

Date: Wed, 2 Oct 2002 18:26:08 +0000 (UTC)
From: "David H. Adler" <dha@panix2.panix.com>
Subject: Re: Help needed to write calendar application
Message-Id: <slrnapmei0.1s7.dha@panix2.panix.com>

In article <amftmn$2js$01$1@news.t-online.com>, Infinity wrote:
> I'm looking for a perl wizard to help create a calendar
> application for

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

http://jobs.perl.org may be of more use to you

Yours for a better usenet,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Hello breasts!          - subbes


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

Date: Wed, 2 Oct 2002 12:12:58 -0700
From: "Newbie" <mike_constant@yahoo.com>
Subject: Re: How can I count files in a directory?
Message-Id: <anfggl$e1ach$1@ID-161864.news.dfncis.de>


"Helgi Briem" <helgi@decode.is>
>
> Don't top-post.  It annoys the regular and
> severely reduces your chances of people
> taking you seriously.
>
Top post? You just did.




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

Date: Wed, 2 Oct 2002 13:48:32 -0500
From: Barry Kimelman <barryk2@delete_me.mts.net>
Subject: How to geta list of perl modules
Message-Id: <MPG.1804fb78d306445598972d@east.usenetserver.com>

How do you get a list of modules that are installed on your system
(UNIX or windows) ? I know you can use perldoc to get info on a
specific module, but I need to get a list of ALL the installed modules.

TIA for all your help.


---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com



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

Date: Wed, 2 Oct 2002 12:28:53 -0700
From: "Newbie" <mike_constant@yahoo.com>
Subject: Re: How to geta list of perl modules
Message-Id: <anfheg$du521$1@ID-161864.news.dfncis.de>


"Barry Kimelman" <barryk2@delete_me.mts.net> wrote > How do you get a list
of modules that are installed on your system
> (UNIX or windows) ? I know you can use perldoc to get info on a
> specific module, but I need to get a list of ALL the installed modules.
>
> TIA for all your help.
>
You can traverse all directories in @INC and dump out files ending with
".pm". You might want to use File::Find for tree traversal.




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

Date: Thu, 3 Oct 2002 06:49:16 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: How to geta list of perl modules
Message-Id: <kRIm9.44986$g9.127112@newsfeeds.bigpond.com>


Barry Kimelman wrote in message ...
>How do you get a list of modules that are installed on your system
>(UNIX or windows) ? I know you can use perldoc to get info on a
>specific module, but I need to get a list of ALL the installed modules.
>
>TIA for all your help.
>
>
>---------
>
>Barry Kimelman
>Winnipeg, Manitoba, Canada
>email : bkimelman@hotmail.com
>

You need Perldiver. Search google or try
http://cgi.resourceindex.com/detail/03915.html

gtoomey




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

Date: Wed, 2 Oct 2002 14:09:51 -0700
From: "David A. Finney" <dfinney@cts.com>
Subject: html::treebuilder
Message-Id: <3d9b6094$0$20549$e2e8da3@nntp.cts.com>

Checking www.perldoc.com, I find that HTML::TreeBuilder is documented for
version 5.6.1, but a search in the 5.8 documents yields no hits at all. Is
this module available for 5.8? Should a documentation search list previously
documented modules with an explanation of their fate (documentation
restructured, obsoleted, deprecated)?

Thanks in advance




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

Date: 02 Oct 2002 11:09:35 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Mac OS X and Perl 6
Message-Id: <864rc4yaow.fsf@red.stonehenge.com>

>>>>> "Da" == Da Witch <heather710101@yahoo.com> writes:

Da> Somehow I thought that Perl was a lot more committed to Linux than
Da> that.

Just another data point (in addition to the other items in this thread):

  I used Perl long before Linux was even around.

print "Just another Perl hacker,"
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 02 Oct 2002 20:19:45 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Mac OS X and Perl 6
Message-Id: <slrnapml22.dl7.rgarciasuarez@rafael.example.com>

Da Witch wrote in comp.lang.perl.misc :
> 
> In O'Reilly's page on the Mac OS X Conference (url below), it says
> that "[a]lmost all of the Perl 6 core team has switched to Mac OS X."
> I was quite surprised by that statement (is it even true???).  Somehow
> I thought that Perl was a lot more committed to Linux than that.  I
> guess I was mistaken...  As a die-hard fan of Linux, or rather, of the
> idea of a non-proprietary operating system, I'm rather bummed by these
> news.

Perl, in fact, is committed to portability. It happens that many Perl 5
developers program on Linux, probably because a Linux box is cheap. But
Perl 5 is routinely tested on Windows, Cygwin, AIX, HP-UX, IRIX, *BSD
(including MacOS X), VMS, Solaris, OS/390 and Tru64, and is ported to
many more platforms.


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

Date: Wed, 2 Oct 2002 21:32:19 +0000 (UTC)
From: Da Witch <heather710101@yahoo.com>
Subject: Re: Mac OS X and Perl 6
Message-Id: <anfol3$q75$1@reader1.panix.com>

In <864rc4yaow.fsf@red.stonehenge.com> merlyn@stonehenge.com (Randal L. Schwartz) writes:

>>>>>> "Da" == Da Witch <heather710101@yahoo.com> writes:

>Da> Somehow I thought that Perl was a lot more committed to Linux than
>Da> that.

>Just another data point (in addition to the other items in this thread):

>  I used Perl long before Linux was even around.

Sloppy writing on my part.  I should have written "committed to the
FSF-ish idea of open, non-proprietary software."



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

Date: Thu, 3 Oct 2002 07:38:49 +1000
From: "Tom Beer" <tom.beer@btfinancialgroup.spamfilter.com>
Subject: Re: Mac OS X and Perl 6
Message-Id: <anfp19$c50$1@merki.connect.com.au>

Dave Peacock wrote in message ...
>
>Apart from the fact that Linux is not the be-all and end-all of
>non-proprietary OS, Mac OS X is based on BSD which has as much to
>do with Perl has any other Unix-like OS out there...

Another point is that OS X is based on Darwin, which is open source, so it's
not all evil.

Tom.








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

Date: Wed, 02 Oct 2002 11:25:08 -0700
From: brian d foy <comdog@panix.com>
Subject: Re: New Perl Module for QA Engineers
Message-Id: <021020021125083485%comdog@panix.com>

In article <65fb4119.0210020522.13118b48@posting.google.com>, Rob Marchetti <robert.marchetti@fmr.com> wrote:

> http://sourceforge.net/projects/samie/
> 
> S.A.M. is a simple automation module written in Perl that allows a
> user to automate Internet Explorer. 

don't forget to mention that it's only for Windows platforms...

-- 
brian d foy <comdog@panix.com> - Perl services for hire
The Perl Review - a new magazine devoted to Perl 
<http://www.theperlreview.com>


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

Date: Wed, 2 Oct 2002 15:35:07 -0300
From: Nuba <nuba@dcc.ufmg.br>
Subject: newbie fine-tune first program mod_perl
Message-Id: <Pine.GSO.4.21.0210021530500.17405-100000@turmalina.dcc.ufmg.br>

Hi again ! 

Big thanks Janek for the feedback. I stripped the code hardly to reduce it
to the essential but wasn't able to get it under the 100-lines-limit that
were recommended. ( Of course I could reduce it to a long one-line, but
that wouldn't be fair. Currently it takes 450 lines with a LOT of
whitespaces to helo organize it visually).

So, instead of posting all this stuff here, I've upped the code to my
webserver. There is a syntax-highlighted page generated by VIM and a plain
one too. Both of them are plenty of comments.

The URL for the code is : http://foco.fae.ufmg.br/zerokid/perl/

The main points :

	. I've kept it all inside one single perl script (with 2500
lines). Is this OK ?

	. I have do a "undef-party" with all variables because of mod_perl
persistence. Although I've read a lot regarding mod_perl_traps, migration
from CGI, etc. I lack of "perl experience", and still haven't figured how
to work this out.

	. As I've read to stay away from globals variables, I've put my
entire perl program inside a subroutine. But I confess this scope-stuff is
kind of a big confusion to me, and it were done as 'vodoo-coding'.


I have the feeling that these are some ridiculous points. But please be
gentle with this 4 months perl-baby :)


And just in case you get upset thinking I am killing the camel spirit with
my coding habits, please relax and enjoy some Childern's Artwork thru the
same perl program I am talking about. ( I hope you'll write a nice
followup after doing that :) ) The URL is

http://foco.fae.ufmg.br/zerokid/zerokid.pl?idioma=br&secao=ver_obras_de_arte

(BIG) Thanks in advance !

Nuba Princigalli
nuba@dcc.ufmg.br



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

Date: Wed, 02 Oct 2002 18:25:56 GMT
From: "Dick Penny" <penny1482@attbi.com>
Subject: numbers & strings again (and again and again)
Message-Id: <TSGm9.12304$FO4.1941@sccrnsc03>

I've searched through comp.lang.perl archieves back til 1998 and read ALL
the articles re numbers & strings. I have concluded:
1) you're not supposed to think about it, Perl knows what to do
2) Perl keeps two (maybe more) versions of an item & converts/uses as is
appropriate
3) ALL docs say adding a zero (ie, forcing a numeric evaluate) converts a
string to a number.

My simplified tests below do not support #3. I am using Data::Dumper
printout as the arbitrar of what is number and what is a string. Maybe this
is wrong.

Why do I care? 1) curiosity & learning Perl, 2) I really have a large array
of arrays that I use as a 2D matrix many times and believe that it *ought*
to be stored as floats or dbls in the first place and I cannot get
Data::Dumper to display anything except strings. The numbers start out as
positive integers. I even tried POSIX's strtod, still Data::Dumper reported
the result as a string.
__________testing code
use strict;
use warnings;
use Data::Dumper;
my @list1 = ('30','37' );
my @list2 = ('3',4 );
print Dumper @list1;
print Dumper @list2;
foreach (@list1) { $_ += 1; }
print Dumper @list1;
_____________output
VAR1 = '30';
$VAR2 = '37';
$VAR1 = '3';
$VAR2 = 4;  #clearly D::D sees this as an integer
$VAR1 = '31';  #but not this even after a clear numeric operation
$VAR2 = '38';

Productive thoughts/comments requested. Perl trolls can stay under their
bridge.
--
Dick Penny




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

Date: 2 Oct 2002 14:25:53 -0700
From: tewall@lycos.com (Tom Ewall)
Subject: Odd behavior for variables "a" and "b"
Message-Id: <85bf428.0210021325.5f01ec07@posting.google.com>

Wierd behavior question.  There are two files here.  The second one
calls the first and prints out the value of the variable b.  This
program works.  However, if the "b" is replaced everywhere by "c", it
no longer works.  (The following error message appears.  Global symbol
"$c" requires explicit package name at C:\ScopeTest.pl line 9.)  If
the line "#our $b;" is uncommented (replacing "b" with "c" of course),
then it will work.  The variables "a" and "b" work with the "our $b;"
commented, but other variables (at least none we could find) do not
work.

The question is, why the unique behavior with the variables "a" and
"b"?  We're using Perl 5.6.1 build 630 on Windows 2000.  Several of us
have tried it and the behavior is consistent on different machines.


-----------------------------
(This file is ScopeTest2.pl)

use strict;

our $b;
$b = 20;
------------------

#!\Perl\bin\perl

use strict;

require 'ScopeTest2.pl';

#our $b;

print "b: $b";


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

Date: 2 Oct 2002 22:01:43 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Odd behavior for variables "a" and "b"
Message-Id: <anfqc7$ksd$1@canopus.cc.umanitoba.ca>

In article <85bf428.0210021325.5f01ec07@posting.google.com>,
Tom Ewall <tewall@lycos.com> wrote:
:Wierd behavior question.  There are two files here.  The second one
:calls the first and prints out the value of the variable b.  This
:program works.  However, if the "b" is replaced everywhere by "c", it
:no longer works.  (The following error message appears.  Global symbol
:"$c" requires explicit package name at C:\ScopeTest.pl line 9.)  If
:the line "#our $b;" is uncommented (replacing "b" with "c" of course),
:then it will work.  The variables "a" and "b" work with the "our $b;"
:commented, but other variables (at least none we could find) do not
:work.

:The question is, why the unique behavior with the variables "a" and
:"b"?

$a and $b are magic.

  sort LIST
  [...]
             In the interests of efficiency the normal calling code for
             subroutines is bypassed, with the following effects: the
             subroutine may not be a recursive subroutine, and the two
             elements to be compared are passed into the subroutine not via @_
             but as the package global variables $a and $b (see example
             below).  They are passed by reference, so don't modify $a and $b.
             And don't try to declare them as lexicals either.

--
Oh, to be a Blobel!


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

Date: 2 Oct 2002 12:27:12 -0700
From: jhgraves@gis.net (John)
Subject: Perl script stops with the following message??
Message-Id: <8014a38c.0210021127.2326a67c@posting.google.com>

C:\mrtg-2.9.22\bin>perl cfgmaker public@localhost
"use" not allowed in expression at C:/Perl/lib/FindBin.pm line 14, at end of lin
e
syntax error at C:/Perl/lib/FindBin.pm line 14, near "head1 SYNOPSIS

 use FindBin"
BEGIN not safe after errors--compilation aborted at C:/Perl/lib/FindBin.pm line
15.
Compilation failed in require at cfgmaker line 40.
BEGIN failed--compilation aborted at cfgmaker line 40.


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

Date: Wed, 02 Oct 2002 19:41:01 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Perl script stops with the following message??
Message-Id: <hhimpugrcdd3eh4br278td0jsrfkn2mtj6@4ax.com>

John wrote:

>C:\mrtg-2.9.22\bin>perl cfgmaker public@localhost
>"use" not allowed in expression at C:/Perl/lib/FindBin.pm line 14, at end of lin
>e
>syntax error at C:/Perl/lib/FindBin.pm line 14, near "head1 SYNOPSIS
>
> use FindBin"
>BEGIN not safe after errors--compilation aborted at C:/Perl/lib/FindBin.pm line
>15.
>Compilation failed in require at cfgmaker line 40.
>BEGIN failed--compilation aborted at cfgmaker line 40.

What is cfgmaker?

It looks odd to me, it's as if the "=" sign that should be there just in
front of "head1", as a start of the pod,  isn't there, or it's being
misinterpreted as an assignment operator.

Does FindBin.pm compile properly by itself? I mean, does a command line
like

	perl -MFindBin -e 'print qq[ok\n]'
or
	perl -MFindBin -e "print qq[ok\n]"

depending on the platform, indeed print "ok"? Ooh, you're on Windows, so
use the second form.

-- 
	Bart.


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

Date: 2 Oct 2002 19:42:55 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Perl script stops with the following message??
Message-Id: <anfi7v$h6v$1@canopus.cc.umanitoba.ca>

In article <8014a38c.0210021127.2326a67c@posting.google.com>,
John <jhgraves@gis.net> wrote:
:C:\mrtg-2.9.22\bin>perl cfgmaker public@localhost
:"use" not allowed in expression at C:/Perl/lib/FindBin.pm line 14, at end of line
:syntax error at C:/Perl/lib/FindBin.pm line 14, near "head1 SYNOPSIS
:
: use FindBin"
:BEGIN not safe after errors--compilation aborted at C:/Perl/lib/FindBin.pm line
:15.
:Compilation failed in require at cfgmaker line 40.
:BEGIN failed--compilation aborted at cfgmaker line 40.

Looks to me as if cfgmaker does a 'use FindBin;' but that
C:/Perl/lib/FindBin.pm is corrupt -- or else your perl is VERY old.

=head1 SYNOPSIS

would signal the start of some documentation, but it appears it
is being parsed as part of an expression. That might occur if the = is
missing, or if there are extra blanks before it, or if your perl is
ancient (somewhat over a decade old).

Odd thought... I wonder if there might be line-terminator issues
involved? newline vs cr/newline vs cr only, that sort of thing.
You appear to be operating in a Windows environment.
--
Contents: 100% recycled post-consumer statements.


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

Date: Wed, 02 Oct 2002 20:30:23 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Perl script stops with the following message??
Message-Id: <oplmpucutnjsib3ojolu5qc6qg00pjfi1h@4ax.com>

Walter Roberson wrote:

>Looks to me as if cfgmaker does a 'use FindBin;' but that
>C:/Perl/lib/FindBin.pm is corrupt -- or else your perl is VERY old.

Since it complains that "use" can't be used in an expression, it appears
to me that at least it's a perl 5.

-- 
	Bart.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 3903
***************************************


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