[25548] in Perl-Users-Digest
Perl-Users Digest, Issue: 7792 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 17 00:05:43 2005
Date: Wed, 16 Feb 2005 21:05:20 -0800 (PST)
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, 16 Feb 2005 Volume: 10 Number: 7792
Today's topics:
[OT] Re: forms, cgi - beginner question <spamtrap@dot-app.org>
Re: [perl-python] problem: reducing comparison gene.tani@gmail.com
[regexp] capturing many substrings <nospam@nospam.com>
Re: [regexp] capturing many substrings <abigail@abigail.nl>
Re: [regexp] capturing many substrings <skuo@mtwhitney.nsc.com>
Re: [regexp] capturing many substrings <nospam@nospam.com>
\Q acts differently in s/// and m// operations <gargoyle@no.spam>
Re: \Q acts differently in s/// and m// operations <see.sig@rochester.rr.com>
Re: \Q acts differently in s/// and m// operations <gargoyle@no.spam>
Re: forms, cgi - beginner question <jfcampbell@aol.com>
Re: Help Programming in Perl for File Renaming <crazycelicagts@gmail.com>
Re: Logging into and parsing a website using Perl <bonjo90@yahoo.co.in>
Re: Logging into and parsing a website using Perl <segraves_f13@mindspring.com>
perl script to write to a text file (MOUNIL)
Re: perl script to write to a text file <spamtrap@dot-app.org>
Re: perl script to write to a text file <mounilkadakia@hotmail.com>
Re: perl script to write to a text file <spamtrap@dot-app.org>
Re: perl script to write to a text file <postmaster@castleamber.com>
Re: Problem with encoding with Spreadsheet::Writer jmcnamara@cpan.org
Re: Problem with IO::Socket xhoster@gmail.com
Re: Record Hash Data Structure (Newbie) xhoster@gmail.com
Re: The Problem with Perl <1usa@llenroc.ude.invalid>
Re: The Problem with Perl <1usa@llenroc.ude.invalid>
Re: Using Perl to Parse Excel File <matternc@comcast.net>
Re: Using Perl to Parse Excel File <mull0024@juno.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Feb 2005 18:12:02 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: [OT] Re: forms, cgi - beginner question
Message-Id: <EpudnSfByMHZTo7fRVn-vw@adelphia.com>
John wrote:
> Now we see 'Internal Server Error please contact the server
> administrator.'
Off-topic for this group, so I'll be brief.
Have a look at Console.app - you can use it to browse your server logs.
That's where Perl's error message will be when you get a "500 Server Error"
like the above. You can configure Console.app to sit quietly in the
background, and then unhide whenever something is added to the currently
open log - quite useful for error logs.
Also, have a look at the CGI::Carp module. You can use it to redirect errors
to the output that's sent to your browser, with this line:
use CGI::Carp qw(fatalsToBrowser);
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 16 Feb 2005 19:31:32 -0800
From: gene.tani@gmail.com
Subject: Re: [perl-python] problem: reducing comparison
Message-Id: <1108611092.143351.216130@o13g2000cwo.googlegroups.com>
This could have been a really unique thread: 15 messages, 1 author
------------------------------
Date: Thu, 17 Feb 2005 00:44:21 +0100
From: "SL" <nospam@nospam.com>
Subject: [regexp] capturing many substrings
Message-Id: <4213da78$0$6601$8fcfb975@news.wanadoo.fr>
Hi,
I want to capture several substrings of a string: I want each occurrence of
"/" (a syllabus boundary), with the character until the next "V" and the
previous "V" included.
For instance, for this string :
$string="OF/LOV/FOGVOTO/LFO";
I want this substrings :
#OF/LOV (from beginnig to first "V" after the first "/")
#V/FOGV (from the first "V" before to the first "V" after)
#V/OTO/LFO (from the first "V" before the end)
I try this :
@syl_boundaries = ($string =~ m|(V?[^V]*/[^V]*V?)|g);
But it returns :
OF/LOV
/FOGV
OTO/LFO
instead, as if the same character may not be captured twice. Any advice
would be very helpful!
Many thanks,
SL
------------------------------
Date: 17 Feb 2005 00:02:07 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: [regexp] capturing many substrings
Message-Id: <slrnd17nnv.2e8.abigail@alexandra.abigail.nl>
SL (nospam@nospam.com) wrote on MMMMCLXXXVII September MCMXCIII in
<URL:news:4213da78$0$6601$8fcfb975@news.wanadoo.fr>:
@@ Hi,
@@
@@ I want to capture several substrings of a string: I want each occurrence of
@@ "/" (a syllabus boundary), with the character until the next "V" and the
@@ previous "V" included.
@@
@@ For instance, for this string :
@@ $string="OF/LOV/FOGVOTO/LFO";
@@
@@ I want this substrings :
@@ #OF/LOV (from beginnig to first "V" after the first "/")
@@ #V/FOGV (from the first "V" before to the first "V" after)
@@ #V/OTO/LFO (from the first "V" before the end)
I guess you want "VOTO/LFO", as "V/OTO/LFO" isn't a substring.
@@ I try this :
@@ @syl_boundaries = ($string =~ m|(V?[^V]*/[^V]*V?)|g);
@@
@@ But it returns :
@@ OF/LOV
@@ /FOGV
@@ OTO/LFO
@@ instead, as if the same character may not be captured twice. Any advice
@@ would be very helpful!
You can't match the same character twice using m//g, unless you use
a trick:
m!(?=((?:^|V)[^V]*/[^V]*(?:V|$)))!g
seems to do what you want:
$_ = "OF/LOV/FOGVOTO/LFO";
while (m!(?=((?:^|V)[^V]*/[^V]*(?:V|$)))!g) {
print $1, "\n";
}
__END__
OF/LOV
V/FOGV
VOTO/LFO
By using look-ahead, you're not actually consuming anything - so you
can do overlapping matches.
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
------------------------------
Date: Wed, 16 Feb 2005 16:06:03 -0800
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: [regexp] capturing many substrings
Message-Id: <Pine.GSO.4.21.0502161602140.20285-100000@mtwhitney.nsc.com>
On Thu, 17 Feb 2005, SL wrote:
> Hi,
>
> I want to capture several substrings of a string: I want each occurrence of
> "/" (a syllabus boundary), with the character until the next "V" and the
> previous "V" included.
>
> For instance, for this string :
> $string="OF/LOV/FOGVOTO/LFO";
>
> I want this substrings :
> #OF/LOV (from beginnig to first "V" after the first "/")
> #V/FOGV (from the first "V" before to the first "V" after)
> #V/OTO/LFO (from the first "V" before the end)
>
> I try this :
> @syl_boundaries = ($string =~ m|(V?[^V]*/[^V]*V?)|g);
(snipped)
Perhaps something like:
my $string = "OF/LOV/FOGVOTO/LFO";
while ($string =~ m#\G(.*?/.*?)(?=(V|$))#g ) {
print "$1$2\n";
}
See 'perldoc perlre' regarding the \G and look-ahead assertions.
--
Hope this helps,
Steven
------------------------------
Date: Thu, 17 Feb 2005 01:19:32 +0100
From: "SL" <nospam@nospam.com>
Subject: Re: [regexp] capturing many substrings
Message-Id: <4213e2b5$0$6588$8fcfb975@news.wanadoo.fr>
> @@ I want this substrings :
> @@ #OF/LOV (from beginnig to first "V" after the first "/")
> @@ #V/FOGV (from the first "V" before to the first "V" after)
> @@ #V/OTO/LFO (from the first "V" before the end)
>
> I guess you want "VOTO/LFO", as "V/OTO/LFO" isn't a substring.
Yes, sorry.
> You can't match the same character twice using m//g, unless you use
> a trick:
>
> m!(?=((?:^|V)[^V]*/[^V]*(?:V|$)))!g
>
> seems to do what you want:
Yes, it's perfect. Thank you very much.
Regards,
SL
------------------------------
Date: Thu, 17 Feb 2005 01:42:50 GMT
From: gargoyle <gargoyle@no.spam>
Subject: \Q acts differently in s/// and m// operations
Message-Id: <uESQd.358$dn2.30@bignews1.bellsouth.net>
Consider the following code:
#!/usr/bin/perl -w
# NOTE: don't focus on the backslashes, I already know Win32 can
# use / instead. This is simply a regex+metachar question...
$old = 'C:\\test\\1\\'; # old parent dir
$new = 'C:\\test\\2\\'; # new parent dir
$path = 'C:\\test\\1\\bin\\'; # the path we're renaming
warn "old=$old, new=$new, path=$path\n";
warn "----- doing match! -----\n";
$path =~ /^(\Q$old\E)/; # this matches
warn "captured \$1 = $1\n";
$path =~ /^(\Q$new\E)/; # this doesn't
warn "captured \$1 = $1\n";
warn "old=$old, new=$new, path=$path\n";
warn "----- doing substitution! -----\n";
$path =~ s/^\Q$old\E/\Q$new\E/;
warn "old=$old, new=$new, path=$path\n";
__END__
The output:
old=C:\test\1\, new=C:\test\2\, path=C:\test\1\bin\
----- doing match! -----
captured $1 = C:\test\1\
captured $1 = C:\test\1\
old=C:\test\1\, new=C:\test\2\, path=C:\test\1\bin\
----- doing substitution! -----
old=C:\test\1\, new=C:\test\2\, path=C\:\\test\\2\\bin\
In the m// operation, the captured output is the original variable, not
the quotemeta version.
But in the s/// operation, the output is quoted.
Why are they behaving differently? And is there a way to get unquoted
output from the s/// operation, or am I just better off using substr(),
since after all there's no unquotemeta() function?
------------------------------
Date: Thu, 17 Feb 2005 02:36:56 GMT
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: \Q acts differently in s/// and m// operations
Message-Id: <crTQd.15377$H05.4135@twister.nyroc.rr.com>
gargoyle wrote:
...
> In the m// operation, the captured output is the original variable, not
> the quotemeta version.
>
> But in the s/// operation, the output is quoted.
>
> Why are they behaving differently? And is there a way to get unquoted
> output from the s/// operation, or am I just better off using substr(),
> since after all there's no unquotemeta() function?
>
Well, the "replacement" in the s/// operator is a *string*, not a
regexp. And that string is processed per qq(). For that, \Q has
a different meaning -- all non-word characters following \Q are
quoted, just as you noted above. In the m// regexp, it is the
*regexp* characters that are quoted, and not any characters in
the matched string. You probably should simply dispense with the
\Q and \E in your replacement string. For details, see:
perldoc perlop
particularly the sections on quote and quote-like operators and
on regexp quote-like operators.
And there *is* an "unquotemeta" function for a string quoted by
\Q -- eval(qq(qq/$string/)) should do the trick, I think, as in:
d:\junk>perl -e "$a=qq(ab\Q~!@#\E~!@#);print eval qq/qq($a)/"
ab~!@#~!@#
d:\junk>
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Thu, 17 Feb 2005 03:19:29 GMT
From: gargoyle <gargoyle@no.spam>
Subject: Re: \Q acts differently in s/// and m// operations
Message-Id: <53UQd.791$1x1.484@bignews6.bellsouth.net>
On 2005-02-17, Bob Walton <see.sig@rochester.rr.com> wrote:
> Well, the "replacement" in the s/// operator is a *string*, not a
> regexp. And that string is processed per qq(). For that, \Q has
> a different meaning -- all non-word characters following \Q are
> quoted, just as you noted above.
Aha! Now I understand. Thanks for clearing that up.
> And there *is* an "unquotemeta" function for a string quoted by
> \Q -- eval(qq(qq/$string/)) should do the trick, I think, as in:
>
> d:\junk>perl -e "$a=qq(ab\Q~!@#\E~!@#);print eval qq/qq($a)/"
> ab~!@#~!@#
> d:\junk>
Interesting... But I have trouble understanding the impact of several
levels of quoting and interpolation. It's late though, so I'll re-read
the perlop manpage tomorrow and see if I can make sense of it.
------------------------------
Date: 16 Feb 2005 15:13:25 -0800
From: "John" <jfcampbell@aol.com>
Subject: Re: forms, cgi - beginner question
Message-Id: <1108595605.301281.142740@c13g2000cwb.googlegroups.com>
Partition the problem domain? When I started, I couldn't even find the
problem domain, so thanks for bearing with me.
Am I going to write CGI scripts? Maybe not. Ideally I'd like to
commission someone who's better at it. We had an exchange earlier in
this thread over the word 'doable.' You and I both know this is doable.
My job is to convince people in my organization that it's so doable
that it's the right tool for the job. That includes convincing my boss,
who might never have heard of Perl or CGI, and convincing a service
department that would rather not be bothered developing any. The latter
might easily convince the former that it's too much trouble and argue
for a competing tool (for example, human beings doing the job of
monkeys). However,if wifty ol' John has mangaged to cobble together a
form-finagling Web server in the basement on his day off, it's harder
to bellyache out of setting one up.
------------------------------
Date: 16 Feb 2005 15:27:32 -0800
From: "Jon" <crazycelicagts@gmail.com>
Subject: Re: Help Programming in Perl for File Renaming
Message-Id: <1108596452.318974.294440@l41g2000cwc.googlegroups.com>
Hello...thanks for the response. i am a bit confused on slurp the file
into an array...can you give me an example and what not. Thanks.
------------------------------
Date: Wed, 16 Feb 2005 16:53:54 -0500
From: "Antwerp" <bonjo90@yahoo.co.in>
Subject: Re: Logging into and parsing a website using Perl
Message-Id: <mzQQd.7571$dZ.467863@news20.bellglobal.com>
Thank you for your excellent suggestion.
:-)
Altrus
"Peter Scott" <peter@PSDT.com> wrote in message
news:7RHQd.407246$Xk.367396@pd7tw3no...
: In article <a4yQd.6434$dZ.349666@news20.bellglobal.com>,
: "Antwerp" <bonjo90@yahoo.co.in> writes:
: >Hi,
: >
: > I'm trying to create a perl script that will log into a website (the
login
: >form uses POST), navigate to several pages, and append the (html) content
parsed
: >from those pages to a seperate log file. I'm not very familiar with this
aspect
: >of perl, and have been having some trouble in the POSTing of the form data,
: >while using cookies to log in.
:
: Way too much work to go to. Get WWW::Mechanize from CPAN and you can get
: rid of most of your code.
:
: --
: Peter Scott
: http://www.perlmedic.com/
: http://www.perldebugged.com/
------------------------------
Date: Thu, 17 Feb 2005 01:47:21 GMT
From: "Bill Segraves" <segraves_f13@mindspring.com>
Subject: Re: Logging into and parsing a website using Perl
Message-Id: <JISQd.2909$9J5.1185@newsread2.news.atl.earthlink.net>
"Antwerp" <bonjo90@yahoo.co.in> wrote in message
news:a4yQd.6434$dZ.349666@news20.bellglobal.com...
> Hi,
>
> I'm trying to create a perl script that will log into a website (the
login
> form uses POST), navigate to several pages, and append the (html) content
parsed
> from those pages to a seperate log file. I'm not very familiar with this
aspect
> of perl, and have been having some trouble in the POSTing of the form
data,
> while using cookies to log in.
>
> Visting the site automatically redirects you to a login page. Once you
fill
> out the login form and click the submit button, you are redirected to the
main
> site index. The login form uses cookies to establish identity.
>
> I've searched through several google resources, and have built upon
what
> I've read. I *believe* I am now storing the cookies I come across when
loading
> the page (using a cookie jar), however, this doesn't seem to be allowing
me to
> log on to the secure areas of the site. I suspect this is because I am not
> properly sending the appropriate cookies with every request, or else am
not
> properly POSTing the login form data, or otherwise not 'following' the
redirect
> to the secure area of the site.
>
> At this point in time, I am just trying to get my script to login to
the
> page (using my appropriate credentials), and then display the site index.
>
> If someone could please offer me some insight and direction into using
the
> appropriate modules
<snip>
See Randal L. Schwartz' excellent article "Automatically Testing a Form":
http://www.stonehenge.com/merlyn/WebTechniques/col43.html
for something to help you get started.
In addition, you should review the documentation for LWP::UserAgent,
HTTP::Request::Common, and HTTP::Cookies to see how to perform the steps you
wish to perform after you login.
Good luck!
--
Bill Segraves
------------------------------
Date: 16 Feb 2005 15:27:59 -0800
From: mounilkadakia@hotmail.com (MOUNIL)
Subject: perl script to write to a text file
Message-Id: <a8500a89.0502161527.2e0bb3a@posting.google.com>
hi ppl,
I am a newbie just tinkering with perl. what i am trying to do
at the moment is writing a script to listen in on a socket. i want to
save the data passed on from the server script to the client script;
in a text file. any help would be highly appreciated.
thanks,
Mounil
------------------------------
Date: Wed, 16 Feb 2005 18:37:25 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl script to write to a text file
Message-Id: <8OCdnctcxeioRI7fRVn-ug@adelphia.com>
MOUNIL wrote:
> I am a newbie just tinkering with perl. what i am trying to do
> at the moment is writing a script to listen in on a socket. i want to
> save the data passed on from the server script to the client script;
> in a text file. any help would be highly appreciated.
What have you tried so far? What did it do, and how is that different from
what you expected it to do?
Have you read the posting guidelines that are posted here frequently?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 16 Feb 2005 15:52:18 -0800
From: "Mounilk" <mounilkadakia@hotmail.com>
Subject: Re: perl script to write to a text file
Message-Id: <1108597938.734359.305730@z14g2000cwz.googlegroups.com>
I've written 2 scripts in perl; one is the server side script and the
other is the client side script. I run the scripts from two terminals.
Both create,bind and listen in to the socket on the local host machine
(127.0.0.1) . When the connection is established, the server script
passes on some data onto the client script. For eg, just a statement
like "You are now connected to the server". I havent been able to find
out how i can save this data into a text file.
- Mounil
------------------------------
Date: Wed, 16 Feb 2005 20:36:06 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl script to write to a text file
Message-Id: <h-idndCuqKqVaI7fRVn-rQ@adelphia.com>
Mounilk wrote:
> passes on some data onto the client script. For eg, just a statement
> like "You are now connected to the server". I havent been able to find
> out how i can save this data into a text file.
Open the file for output and print to it. See:
perldoc -f open
perldoc -f print
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 17 Feb 2005 02:15:35 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: perl script to write to a text file
Message-Id: <Xns95FFCE174545Ccastleamber@130.133.1.4>
Sherm Pendley wrote:
> Mounilk wrote:
>
>> passes on some data onto the client script. For eg, just a statement
>> like "You are now connected to the server". I havent been able to find
>> out how i can save this data into a text file.
>
> Open the file for output and print to it. See:
>
> perldoc -f open
> perldoc -f print
Have also a look at
File::Slurp
Or:
yourscript.pl > out.txt
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 16 Feb 2005 16:58:34 -0800
From: jmcnamara@cpan.org
Subject: Re: Problem with encoding with Spreadsheet::Writer
Message-Id: <1108601914.323302.68710@z14g2000cwz.googlegroups.com>
I'm guessing that you are talking about Spreadsheet::WriteExcel.
Spreadsheet::WriteExcel supports wide characters in UTF16 and UTF8
formats. Other encodings are also supported via Perl 5.8's unicode
handling.
Search the documentation for the word unicode for further information.
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm
There is also an example in Big5 Chinese in the Spreadsheet::WriteExcel
distro:
http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.11/examples/unicode_big5.pl
http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.11/examples/unicode_big5.txt
John.
--
------------------------------
Date: 17 Feb 2005 00:30:06 GMT
From: xhoster@gmail.com
Subject: Re: Problem with IO::Socket
Message-Id: <20050216193006.467$Ud@newsreader.com>
Martin Kissner <news@chaos-net.de> wrote:
>
> >> % ./lgetr.pl wuarchive.wustl.edu:ftp
> >> should print the welcome message of the ftp service on
> >> wuarchive.wustl.edu
> >
> > For me, it does do that.
>
> Thank you for that information.
> What is your OS? Mine is Darwin 7.8 (Mac OS X)
> Which Version of Perl are you using. I am using Perl 5.8.1
Sorry, I should have included that:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-1.1931.2.393.entsmp,
archname=i386-linux-thread-multi
> >> % ./lgetr.pl mail.hotmail.com:smtp
> >> should print the welcome message of the smtp-server on
> >> mail.motmail.com
> >
> > the smtp-server on mail.hotmail.com doesn't seem to have a welcome
> > message.
>
> With telnet I get
>
> | 220 mc9-f7.hotmail.com Sending unsolicited commercial or bulk e-mail to
> | Microsoft's computer network is prohibited. Other restrictions are
> | found at http://privacy.msn.com/Anti-spam/. Violations will result in
> | use of equipment located in California and other states. Wed, 16 Feb
> | 2005 13:48:09 -0800
For me it just hung, even with telnet. Maybe it was just very slow and I
didn't wait long enough.
> I do still not know how to find out why it doesn't work on my system.
> Any suggestions are welcome.
After you added error checking, did it still hang with the first one, or
did you get a connection refused?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 17 Feb 2005 00:24:40 GMT
From: xhoster@gmail.com
Subject: Re: Record Hash Data Structure (Newbie)
Message-Id: <20050216192440.255$qD@newsreader.com>
rajasekaran.natarajan@gmail.com wrote:
<previously I wrote>:
> >parallel hash
> parrellel hash you mean using references, I am not yet caught upto
> references
> (esp to arrays and hashes) may be I will try that after this iteration
> with hashes. Actually I am doing this problem to learn Perl.
Kind of the opposite, by parallel hashes I mean *not* using references,
or at least at one fewer level of them.
Assuming you are have a million of 3-D points, you could store them
something like:
$point{$name_of_point}{X}=34.589;
$point{$name_of_point}{Y}=4.998;
$point{$name_of_point}{Z}=9.876;
Here, you have %point is a hash with one million entries, and each
entry is a (reference to an) anonymous hash (with three entries each).
So you have 1,000,001 hashes.
Or, you could do:
$point_x{$name_of_point}=34.589;
$point_y{$name_of_point}=4.998;
$point_z{$name_of_point}=9.876;
Here, you have only 3 hashes (and none of them references). A lot less
overhead. But, the other way is usually better if you are not worried
about the memory overhead. For example, if you need to pass the whole
structure into a sub, you need to pass 3 references for this case rather
than 1 for the previous case. And if you need to change to 4D points
rather than 3D, there would be much more code to change in this case.
Other than memory, the one nice thing about the second way is that "strict"
will catch it if you commit a typo like $point_w{$name_of_point}, while it
won't catch it if you typo like $point{$name_of_point}{W}.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Thu, 17 Feb 2005 01:42:50 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: The Problem with Perl
Message-Id: <Xns95FFD2B6F778Casu1cornelledu@127.0.0.1>
"Rhugga" <rhugga@yahoo.com> wrote in
news:1108563727.663335.167690@c13g2000cwb.googlegroups.com:
>
> ??? They are the same?
>
> int foo(int x) {
> return (x*2);
> }
>
> char foo() {
> return "A";
> }
>
> float foo() {
> return 100.99;
> }
>
> All completely different functions in C. The name 'foo' may be the
> same but as far as the compiler is concerned, they are different
> functions. Are you saying these three functions above are the same? I
> believe you are suffering from learning an interpreted language before
> learning a true language like C or C++.
You have now certified yourself as an ignorant troll who does not know
anything about C:
D:\Dload> gcc -Wall -c t.c
t.c:5: error: conflicting types for `foo'
t.c:1: error: previous declaration of `foo'
t.c: In function `foo':
t.c:6: warning: return makes integer from pointer without a cast
t.c: At top level:
t.c:9: error: conflicting types for `foo'
t.c:5: error: previous declaration of `foo'
*PLONK*
Sinan.
>
------------------------------
Date: Thu, 17 Feb 2005 01:51:22 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: The Problem with Perl
Message-Id: <Xns95FFD4298E32Dasu1cornelledu@127.0.0.1>
"Rhugga" <rhugga@yahoo.com> wrote in
news:1108563727.663335.167690@c13g2000cwb.googlegroups.com:
> char foo() {
> return "A";
> }
Here you declare foo as returning a char, but instead you return a pointer
to const char. Hmmm ...
...
> I believe you are suffering from learning an interpreted language
> before learning a true language like C or C++.
The definition of foo above is not legal in C or C++.
I think you are suffering from not having learned C or C++.
Sinan.
------------------------------
Date: Wed, 16 Feb 2005 20:10:35 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Using Perl to Parse Excel File
Message-Id: <dPmdnZAz6o2Wco7fRVn-qA@comcast.com>
mull0024@juno.com wrote:
> "No documentation found for "Date::Format"."
>
> "PPM> install Date-Format
> Install package 'Date-Format?' (y/N): y
> Installing package 'Date-Format'...
> Error installing package 'Date-Format': Could not locate a PPD file for
> package
> Date-Format
> PPM>"
>
> Any advice on how to proceed?
Sorry, I don't use ActivePerl. Date::Format was part of standard install
with my perl, and I don't know anything about PPM.
>
> Thanks again. Seems like the learning never ends with Perl ;-)
>
> Chris
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: 16 Feb 2005 13:13:29 -0800
From: "mull0024@juno.com" <mull0024@juno.com>
Subject: Re: Using Perl to Parse Excel File
Message-Id: <1108588409.164753.274490@f14g2000cwb.googlegroups.com>
"No documentation found for "Date::Format"."
"PPM> install Date-Format
Install package 'Date-Format?' (y/N): y
Installing package 'Date-Format'...
Error installing package 'Date-Format': Could not locate a PPD file for
package
Date-Format
PPM>"
Any advice on how to proceed?
Thanks again. Seems like the learning never ends with Perl ;-)
Chris
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7792
***************************************