[25302] in Perl-Users-Digest
Perl-Users Digest, Issue: 7547 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 21 11:05:45 2004
Date: Tue, 21 Dec 2004 08:05:09 -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 Tue, 21 Dec 2004 Volume: 10 Number: 7547
Today's topics:
Re: File statistics from web page files thanks <j.b.l.0.2.@.hotmail.com>
Re: Good practice to detect empty string? (Anno Siegel)
Re: Hep with Regular Expression <ebenze@hotmail.com>
How to navigate the docs? <please@send.replies.to.ng>
Re: How to navigate the docs? <spamtrap@dot-app.org>
Re: How to navigate the docs? <tadmc@augustmail.com>
Re: Is zero even or odd? <nospam@nospam.com>
Re: Is zero even or odd? <jmw@jmwa.demon.contraspam.yuk>
Re: Is zero even or odd? <jfields@austininstruments.com>
Re: Is zero even or odd? <jfields@austininstruments.com>
Re: Is zero even or odd? <jfields@austininstruments.com>
Re: Is zero even or odd? <spikeywan@bigfoot.com>
Re: Is zero even or odd? <BB@BB.BB>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <BB@BB.BB>
Re: Is zero even or odd? (IFR LIT MET\)
Re: Is zero even or odd? <slord@mathworks.com>
Re: Newbie question (Anno Siegel)
Re: Newbie question <zen13097@zen.co.uk>
Perl vs. .Net regular expressions tconti@hotmail.com
Re: Perl vs. .Net regular expressions <peter@semantico.com>
Re: Perl vs. .Net regular expressions <matthew.garrish@sympatico.ca>
Re: use external files as "HERE-docs" (and avoid the un <1usa@llenroc.ude.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 21 Dec 2004 12:26:56 GMT
From: jbl <j.b.l.0.2.@.hotmail.com>
Subject: Re: File statistics from web page files thanks
Message-Id: <md5gs01t26rfa5r118h2nu8u4n1nf36d1r@4ax.com>
On Mon, 20 Dec 2004 05:36:33 GMT, Joe Smith <joe@inwap.com> wrote:
>jbl wrote:
>> I want to be able to get file statistics from a "friendly" server.
>> Currently from the browser I see a list of .pdf files.
>>
>> http://welcome.brochurearchive.com/pdfs not actual
>>
>> eg;
>> Directory handle: Resource id #2 Files: .
>> ..
>> XiGh_II-p4302-c3837-UK-1.pdf
>> XiGh_II-p4302-c3837-NO-1.pdf
>> XiGh_II-p4302-c3837-SE-1.pdf
>> XiGh_II-p4302-c3837-DK-1.pdf
>>
>> Is there a perl way to get the creation/modification date of the pdf
>> files without having to download the entire page?
>
>Yes, use HEAD instead of GET.
>
>perldoc LWP::Simple
>
> head($url)
> Get document headers. Returns the following 5 values if
> successful: ($content_type, $document_length, $modified_time,
> $expires, $server)
>
> -Joe
Thanks
head($url) got it done
jbl
------------------------------
Date: 21 Dec 2004 12:50:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Good practice to detect empty string?
Message-Id: <cq967a$ecs$1@mamenchi.zrz.TU-Berlin.DE>
<ipellew@pipemedia.co.uk> wrote in comp.lang.perl.misc:
> Hi all;
>
> Pls advise the perlophiliacs method of deciding a string is empty.
>
> I am using
> if ( $@ || $c_var eq "" ) {
> but constantly read `eq` is expensive.
>
> For example is
> if ( $@ || ! length $c_var ) {
> better, faster, cheaper
If you really need to know, "use Benchmark", but that's futile
micro-optimization. The idiomatic way is to test for length.
Be sure the string is defined at all.
Anno
------------------------------
Date: Tue, 21 Dec 2004 09:56:51 -0500
From: "Eric B." <ebenze@hotmail.com>
Subject: Re: Hep with Regular Expression
Message-Id: <1103641166.395153@www.vif.com>
>> I'm hoping someone can help me come up with a regular expression that I
>> need
>> to match the following.
>>
>> I'm looking to match all occurances of format <word>.<word> in a string
>> that
>> is not followed by the words AS. This is coming from an SQL select
>> statement.
>>
>> Basically, I'm looking to match all the field names in an SQL select
>> statement that are not being aliased.
>>
>> For example, in the following statement:
>>
>> Select
>> payment_module.module_name as `alias.name`,
>> payment_module.module_description,
>> payment_module.is_enabled,
>> configuration.configuration_key,
>> configuration.configuration_value,
>> configuration.store_id as `alias.storeid`
>>
>>
>> I'm looking to match only:
>> payment_module.module_description
>> payment_module.is_enabled
>> configuration.configuration_key
>> configuration.configuration_value
>>
>> Ideally, am looking for an expression using subexpressions that further
>> seperate the table name from the field name in this select statement:
>> ie: payment_module and module_description
>> payment_module and is_enabled
>> configuration and configuration_key
>> configuration and
>> configuration_value
>>
>>
>> Any help would be greatly appreciated. So far I've managed to come up
>> with:
>> /(?<!as )(?>([A-Z0-9_-]*)\.([A-Z0-9_-]*))(?![ ]+as[ ]+[A-Z0-9_\-.]+)/i
>>
>> but that doesn't seem to work as it sees the expression alias.name as not
>> being preceeded by "as ".
>
> Would this suffice?
>
> use Data::Dumper;
>
> my $string = "
> payment_module.module_name as `alias.name`,
> payment_module.module_description,
> payment_module.is_enabled,
> configuration.configuration_key,
> configuration.configuration_value,
> configuration.store_id as `alias.storeid`
> ";
>
> my @statements = split(/,\s+/, $string);
> my (@results);
> foreach my $stm (@statements) {
> next if $stm =~ / as `/;
> $stm =~ s/^\s+//;
> my @parts = split(/\./, $stm);
> push(@results, \@parts);
> };
> print Dumper(\@results);
>
Actually, yeah - I think it will do just fine. Thanks. I don't know why,
but I kept on trying to get it to work in one regexp instead of splitting it
into multiple lines to do the work. Thanks for pointing it out!
Eric
------------------------------
Date: Tue, 21 Dec 2004 15:38:48 +0000 (UTC)
From: Mike <please@send.replies.to.ng>
Subject: How to navigate the docs?
Message-Id: <cq9g28$8tt$1@reader2.panix.com>
What do you do when you want to find something in the Perl
documentation, and you have *no idea* in which of the many perlxxxx
it is? I've tried perltoc in the past with little success.
At this point someone would reply "But WHAT are you looking for???",
which would miss the point of my question, which is finding general
strategies for using the Perl docs.
The zsh documentation is also split into several man pages, but at
least one also has the option of doing "man zshall", which brings
up the mongo page for the whole zshebang that one can do a global
search on. Is there anything like this for Perl, or maybe a
search-engine-assisted doc page for Perl? (Google is not good enough
for this task; too many of the Perl keywords are too widely used
for a basic Google search to produce useful hits.)
Mike
------------------------------
Date: Tue, 21 Dec 2004 10:59:02 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How to navigate the docs?
Message-Id: <_-mdnQnX-PzV1VXcRVn-jw@adelphia.com>
Mike wrote:
> What do you do when you want to find something in the Perl
> documentation, and you have *no idea* in which of the many perlxxxx
> it is? I've tried perltoc in the past with little success.
'perldoc perl' gives a pretty good one-line description of the core
pods, and 'perldoc perlmodlib' gives the same for core modules.
<http://perldoc.com> provides full-text searching for the core pods &
modules, and <http://search.perl.org> for CPAN modules.
And of course, there's 'perldoc -q keyword' to search the FAQ.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 21 Dec 2004 10:00:07 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to navigate the docs?
Message-Id: <slrncsgi47.q01.tadmc@magna.augustmail.com>
Mike <please@send.replies.to.ng> wrote:
>
>
> What do you do when you want to find something in the Perl
> documentation, and you have *no idea* in which of the many perlxxxx
> it is?
I grep(1) the *.pod files directly.
If that gives information overload, I grep only the "headlines"
in the *.pod files:
grep ^= *.pod | grep -i searchterm
Another way to reduce the number of hits is to search for "Searchterm"
rather than "searchterm" on the assumption that titles or beginning
of sentences are particularly relevant.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 21 Dec 2004 11:12:37 GMT
From: Fred Bloggs <nospam@nospam.com>
Subject: Re: Is zero even or odd?
Message-Id: <41C8051D.3030401@nospam.com>
Kevin Aylward wrote:
> Fred Bloggs wrote:
>
>>Kevin Aylward wrote:
>>
>>>Fred Bloggs wrote:
>>>
>>>
>>>>Alfred Z. Newmane wrote:
>>>>
>>>>
>>>>>Nicholas O. Lindan wrote:
>>>>>
>>>>>
>>>>>
>>>>>>"John Sefton" <john@petcom.com> wrote
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>0 can't be divided by itself,
>>>>>>
>>>>>>Sure it can: 0 / 0 = 0 * (1 / 0) = 0 * infinity = 1
>>>>>>
>>>>>>It works if the only three numbers in the universe are
>>>>>>0, 1, and infinity -- A number system that seems very
>>>>>>suited to usenet.
>>>>>
>>>>>
>>>>>Except for the fact that: 0 / 0 = undefined
>>>>>
>>>>>Or actually more correct: n / 0 = undefined
>>>>>
>>>>>
>>>>
>>>>0/0={ SET OF ALL INTEGERS }
>>>
>>>
>>>No.
>>>
>>>
>>>
>>>>n/0= NULL SET for n<>0
>>>>
>>>>It is very well-defined.
>>>
>>>
>>>No it isnt.
>>>
>>>Kevin Aylward
>>
>>You apparently have stumbled on something else you know damn little
>>about.
>
>
> There is a lot I don't know, but this isn't an example of such.
>
>
>>In case you need help with this , you might note that "/" is
>>NOT an operator on the integers,
>
>
> No it isn't, it is an operator on all numbers, integer or otherwise.
We were talking about integers, and therefore 0/0={all integers}. You
want to talk about reals then 0/0={ all reals }. Are you saying that 0*x
<> 0? If not then my answer is correct.
>
>
>>it is the "inverse" of a
>>multiplication operator.
>
>
> Sure, you can have *another* meaning to the / operator in a different
> context, but this aint that context. This discussion is about a/b as
> usually understood in arithmetic.
I just told you how it is understood.
>
>
>>Inverse is a well-defined concept but not
>>necessarily a function, it is a set theoretic mapping. E.G. m/n={ q:
>>m=q*n} by definition, so that m/n which is actually a set which can
>>be empty, a singleton, or infinite.
>
>
> My, my, aint you a clever dude...
>
>
>>In the case of m/n, it is then
>>m/n = F^-1(m) where F(x)= n*x. Your reasoning would lead one to
>>believe /: I x I -> I is a function, which it isn't.
>
>
> Nope. I am using a well understood definition of division as applicable
> to this argument.
Really? You never have told us what your "well understood" definition
is- so what exactly are you "using" here?
------------------------------
Date: Tue, 21 Dec 2004 11:23:21 +0000
From: John Woodgate <jmw@jmwa.demon.contraspam.yuk>
Subject: Re: Is zero even or odd?
Message-Id: <KDdnmIFpeAyBFwvq@jmwa.demon.co.uk>
I read in sci.electronics.design that Kevin Aylward
<salesEXTRACT@anasoft.co.uk> wrote (in <hqTxd.17008$ef5.10156@fe1.news.b
lueyonder.co.uk>) about 'Is zero even or odd?', on Tue, 21 Dec 2004:
>How can a limit be
>physically meaningfull, yet meaningless?
I don't know, but the word 'meaningless' is meaningful. I hope that is
of no help whatsoever. (;-)
--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
------------------------------
Date: Tue, 21 Dec 2004 05:53:25 -0600
From: John Fields <jfields@austininstruments.com>
Subject: Re: Is zero even or odd?
Message-Id: <ni3gs058urfpr0bpshjtmhpj2rk8becvtn@4ax.com>
On Mon, 20 Dec 2004 21:43:14 +0100, David Kastrup <dak@gnu.org> wrote:
>John Fields <jfields@austininstruments.com> writes:
>
>> On Mon, 20 Dec 2004 09:21:25 -0600, John Sefton <john@petcom.com>
>> wrote:
>>
>>
>>>It's not a prime, because a prime can
>>>only be divided by itself and 1.
>>
>> ---
>> That's not true. A prime can be divided by anything, but an integer
>> greater than one is prime if its only positive divisors are itself and
>> one, but zero isn't prime because it's even.
>> ---
>>
>>>0 can't be divided by itself,
>>
>> ---
>> Sure it can. Anything (or nothing) divided by itself = 1
>
>Ah, so 1 = 0/0 = (0+0)/0 = (0/0) + (0/0) = 2 ?
---
Apparently!
--
John Fields
------------------------------
Date: Tue, 21 Dec 2004 05:59:48 -0600
From: John Fields <jfields@austininstruments.com>
Subject: Re: Is zero even or odd?
Message-Id: <6u3gs0dnj33nebrbj6no1fvns0lhg9ahoe@4ax.com>
On Mon, 20 Dec 2004 21:54:18 +0000 (UTC), George Cox
<george_coxanti@spambtinternet.com.invalid> wrote:
>John Fields wrote:
>
>> That's not true. A prime can be divided by anything, but an integer
>> greater than one is prime if its only positive divisors are itself and
>> one, but zero isn't prime because it's even.
>
>And two isn't prime because it's even?
---
Oops... That's the exception. Sloppy me. :-(
--
John Fields
------------------------------
Date: Tue, 21 Dec 2004 06:16:46 -0600
From: John Fields <jfields@austininstruments.com>
Subject: Re: Is zero even or odd?
Message-Id: <9q4gs09qc632rq44vtk470bdsma3ko3b8s@4ax.com>
On Mon, 20 Dec 2004 19:21:43 -0500, Shawn Corey
<shawn.corey@sympatico.ca> wrote:
>Nicholas O. Lindan wrote:
>>
>> 1 + 1 = 0/0 + 0/0 = (0 + 0)/0 = 2 * 0/0 = 2
>>
>
> a = b
> a^2 = ab
> a^2 - b^2 = ab - b^2
>(a+b)(a-b) = b(a-b)
> a+b = b
>but a = b
> a+a = a
> 2a = a
> 2 = 1
>
>What could be clearer?
---
b = 1
a = b
a^2 = ab
a^2 - b^2 = ab - b^2
(a+b)(a-b) = b(a-b)
a+b = b
1+1 = 1
--
John Fields
------------------------------
Date: Tue, 21 Dec 2004 12:56:50 -0000
From: "Richard S Beckett" <spikeywan@bigfoot.com>
Subject: Re: Is zero even or odd?
Message-Id: <cq96o6$7ro$1@newshost.mot.com>
> >Nicholas O. Lindan wrote:
> >>
> >> 1 + 1 = 0/0 + 0/0 = (0 + 0)/0 = 2 * 0/0 = 2
> >>
> >
> > a = b
> > a^2 = ab
> > a^2 - b^2 = ab - b^2
> >(a+b)(a-b) = b(a-b)
When you attempt to divide by zero, you get...
> > a+b = b
Division by zero error!
> >but a = b
> > a+a = a
> > 2a = a
> > 2 = 1
> >
> >What could be clearer?
Erm, dunno. Glass?
------------------------------
Date: Tue, 21 Dec 2004 14:10:21 -0000
From: BB <BB@BB.BB>
Subject: Re: Is zero even or odd?
Message-Id: <10sgbmdrl129bb7@corp.supernews.com>
"David C. Ullrich" wrote:
>
> On Mon, 20 Dec 2004 14:34:03 -0000, BB <BB@BB.BB> wrote:
>
> >Josef Moellers wrote:
> >>
> >> Gactimus wrote:
> >> > I know 0 is neither negative or positive but what about odd/even? I think
> >> > it's even.
> >> >
> >> > Odd numbers start at 1 and go every other number 1,3,5,7;1,-1,-3,-5,-7
> >> > Even starts at 2 and go every other number 2,4,6,8;2,0,-2,-4,-6,-8
> >>
> >> As it can be divided by 2 without a remainder, it is obviously even.
> >
> >The divisor would have to be something smaller than 0 like -2.
>
> Huh? 0/2 is somehow undefined because 2 > 0? Interesting.
Well sure. 0 /+N is illogical. It's like asking:
"How many universes are in a black hole ?"
0/-N makes more sense. Therefore, black holes
have lots of useless anti-matter inside of them. ;-)
>
> >Therefore zero is both even and negative.
> >
> >>
> >> --
> >> Josef Möllers (Pinguinpfleger bei FSC)
> >> If failure had no penalty success would not be a prize
> >> -- T. Pratchett
> >
>
> ************************
>
> David C. Ullrich
------------------------------
Date: Tue, 21 Dec 2004 14:38:37 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <NzWxd.7656$yK.1201@newsread3.news.atl.earthlink.net>
Alfred E. Newman wrote:
> Except for the fact that: 0 / 0 = undefined
> Or actually more correct: n / 0 = undefined
Man, like, we don' need no steenkin' facts ...
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Tue, 21 Dec 2004 14:43:26 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <iEWxd.7669$yK.5640@newsread3.news.atl.earthlink.net>
"David Kastrup" <dak@gnu.org> wrote
> 0/0 is clearly, if anything, a constant expression. And it turns out
> [to some] that its value is undefined.
Better minds than can be found here have argued this and not reached
any conclusion. 'Undefined' is the answer given by the teacher in the
7th grade, and will serve for all practical purposes.
Maybe what is needed is a New Number = '*' (or something) = Any Number You Want.
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Tue, 21 Dec 2004 14:46:56 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <AHWxd.7679$yK.2154@newsread3.news.atl.earthlink.net>
"BB" <BB@BB.BB> wrote
> "How many universes are in a black hole ?"
Oh, this sounds like even more fun. Something we know even less
about ...
I would say about a black-hole's-worth.
But I don't believe in black holes.
Makes me an expert on the subject ...
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Tue, 21 Dec 2004 15:20:13 -0000
From: BB <BB@BB.BB>
Subject: Re: Is zero even or odd?
Message-Id: <10sgfpdmcoltt07@corp.supernews.com>
"Nicholas O. Lindan" wrote:
>
> "BB" <BB@BB.BB> wrote
>
> > "How many universes are in a black hole ?"
>
> Oh, this sounds like even more fun. Something we know even less
> about ...
How about some easier questions:
How many black holes are there in the universe ?
Is it meaningful to ask infinity/0 ?
Are we going to need some kind of mathematics
where the second question is somewhat meaningful
in order to answer the first question ?
Is the last (sic) question meaningful ?
>
> I would say about a black-hole's-worth.
>
> But I don't believe in black holes.
>
> Makes me an expert on the subject ...
There are black holes stealing odd socks out of
my laundry.
>
> --
> Nicholas O. Lindan, Cleveland, Ohio
> Consulting Engineer: Electronics; Informatics; Photonics.
> Remove spaces etc. to reply: n o lindan at net com dot com
> psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Tue, 21 Dec 2004 10:39:22 -0500
From: "Richards Noah \(IFR LIT MET\)" <Noah.Richards@infineon.com>
Subject: Re: Is zero even or odd?
Message-Id: <cq9g3d$b70$1@athen03.muc.infineon.com>
> >
> > Nope. I am using a well understood definition of division as applicable
> > to this argument.
>
> Really? You never have told us what your "well understood" definition
> is- so what exactly are you "using" here?
>
You guys are arguing two different things. The argument that 0/0 is the set
of all integers/reals/whatever you are using is the set theory response to
the question. However, the more commonly used form is the algebraicly
accepted argument that states that division is a function of the forms: Z /
Z -> Q, R / R -> R, etc. In this definition, division by 0 is undefined for
all Z or R, including 0. So, you are both correct, but arguing different
things.
------------------------------
Date: Tue, 21 Dec 2004 10:58:07 -0500
From: "Steven Lord" <slord@mathworks.com>
Subject: Re: Is zero even or odd?
Message-Id: <cq9h6f$6g8$1@fred.mathworks.com>
"Nicholas O. Lindan" <see@sig.com> wrote in message
news:iEWxd.7669$yK.5640@newsread3.news.atl.earthlink.net...
> "David Kastrup" <dak@gnu.org> wrote
>
> > 0/0 is clearly, if anything, a constant expression. And it turns out
> > [to some] that its value is undefined.
>
> Better minds than can be found here have argued this and not reached
> any conclusion. 'Undefined' is the answer given by the teacher in the
> 7th grade, and will serve for all practical purposes.
>
> Maybe what is needed is a New Number = '*' (or something) = Any Number You
Want.
Just FYI, if you're performing arithmetic using the IEEE 754 standard, then
n/0 for n not equal to 0 is the infinity with the same sign as n (i.e. -1/0
is -Inf while 1/0 is +Inf). Under the standard, 0/0 is NaN (Not a Number).
If you scroll down to "Special Operations" on this page:
http://stevehollasch.com/cgindex/coding/ieeefloat.html
you'll see some of the operations on numbers that can be represented in the
form given by the standard that give "special" results.
Professor William Kahan also discusses some of these types of operations in
these lecture notes, starting around page 6:
http://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
--
Steve Lord
slord@mathworks.com
------------------------------
Date: 21 Dec 2004 13:19:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie question
Message-Id: <cq97sl$ecs$2@mamenchi.zrz.TU-Berlin.DE>
Ken <x3v0-usenet@yahoo.com> wrote in comp.lang.perl.misc:
> > ####################### SCRIPT #######################
> >
> > #!/usr/local/bin/perl -w
> >
> > # turn on perl's safety features
> > use strict;
> > #use warning;
> >
> > # load our modules
> >
> > my $msg;
> > my $current_dir = `pwd`;
> > my $log="dtest.log";
> > print "Current directory is $current_dir";
> >
> > # Main
> >
> > prepare
> >
>
> Try this instead:
>
> prepare();
>
> You can't call subroutines without the parentheses.
That's wrong. Parameterless subs are called without parentheses all
the time. The only requisite is that the sub be declared at compile
time. That means it must be defined, or at least predeclared, before
its first use.
> You also need to
> make sure all expressions end in a semicolon.
That's not necessary either. The last statement in a block doesn't
need a semicolon, though it is usually written unless the block ends
on the same line.
Anno
------------------------------
Date: 21 Dec 2004 14:00:59 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: Newbie question
Message-Id: <41c82c9b$0$8347$db0fefd9@news.zen.co.uk>
On Mon, 20 Dec 2004 09:37:47 -0500, Ken <x3v0-usenet@yahoo.com> wrote:
> Try this instead:
>
> prepare();
>
> You can't call subroutines without the parentheses.
Yes you can, as long as the sub has been defined before the call:
[davew@localhost tmp] $ perl
#!/usr/bin/perl
use strict;
use warnings;
sub wotsit {
print "here\n";
}
wotsit;
__END__
here
[davew@localhost tmp] $
Define the sub after the call, however, and it fails:
[davew@localhost tmp] $ perl
#!/usr/bin/perl
use strict;
use warnings;
wotsit;
sub wotsit {
print "here\n";
}
__END__
Bareword "wotsit" not allowed while "strict subs" in use at - line 5.
Execution of - aborted due to compilation errors.
[davew@localhost tmp] $
------------------------------
Date: 21 Dec 2004 05:53:32 -0800
From: tconti@hotmail.com
Subject: Perl vs. .Net regular expressions
Message-Id: <1103637212.439876.245990@c13g2000cwb.googlegroups.com>
Howdy:
I am looking for a little input on an issue we are grappling with. We
are updating our site to be Unicode compliant. We have some
applications running under Perl 5.6.1 which has "sketchy" support for
Unicode. So there is a push to re-write these applications in .Net
(C#) because we are largely a Windows shop. Most of our Perl code is
regex heavy. .Net does have a fairly robust regex engine, but I have
never perfmance tested it against Perl. Has anyone done such testing
and what are your thoughts/results? Also, if we choose to stick with
Perl we would need to move to 5.8 for Unicode support. Would this just
be a simple recompile or would there be any other issues that would
need to be addressed?
Please let me know what you think.
Happy Holidays,
Tom
------------------------------
Date: Tue, 21 Dec 2004 14:26:54 +0000
From: Peter Hickman <peter@semantico.com>
Subject: Re: Perl vs. .Net regular expressions
Message-Id: <41c832ad$0$4515$afc38c87@news.easynet.co.uk>
tconti@hotmail.com wrote:
> Howdy:
>
> I am looking for a little input on an issue we are grappling with. We
> are updating our site to be Unicode compliant. We have some
> applications running under Perl 5.6.1 which has "sketchy" support for
> Unicode. So there is a push to re-write these applications in .Net
> (C#) because we are largely a Windows shop. Most of our Perl code is
> regex heavy. .Net does have a fairly robust regex engine, but I have
> never perfmance tested it against Perl. Has anyone done such testing
> and what are your thoughts/results? Also, if we choose to stick with
> Perl we would need to move to 5.8 for Unicode support. Would this just
> be a simple recompile or would there be any other issues that would
> need to be addressed?
> Please let me know what you think.
>
> Happy Holidays,
> Tom
>
Is there any reason you can't update your version of Perl?
------------------------------
Date: Tue, 21 Dec 2004 09:21:19 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Perl vs. .Net regular expressions
Message-Id: <yjWxd.9651$Z%3.452002@news20.bellglobal.com>
<tconti@hotmail.com> wrote in message
news:1103637212.439876.245990@c13g2000cwb.googlegroups.com...
> Howdy:
>
> I am looking for a little input on an issue we are grappling with. We
> are updating our site to be Unicode compliant. We have some
> applications running under Perl 5.6.1 which has "sketchy" support for
> Unicode. So there is a push to re-write these applications in .Net
> (C#) because we are largely a Windows shop. Most of our Perl code is
> regex heavy. .Net does have a fairly robust regex engine, but I have
> never perfmance tested it against Perl. Has anyone done such testing
> and what are your thoughts/results?
I can't speak to any possible speed differences, but I have found .Net
regexes to be a pain-in-the-ass to deal with for other reasons. (Mostly
because of all the extra lines of code necessary to do simple tasks, and
because of the limited modifiers that can be used.) If all your code does is
simple searches and replaces, though, it might not be so painful to port
over (I just ported a 10000+ line Perl/Tk app to C# in a little over a
week).
> Also, if we choose to stick with
> Perl we would need to move to 5.8 for Unicode support. Would this just
> be a simple recompile or would there be any other issues that would
> need to be addressed?
> Please let me know what you think.
>
If you're on Windows, you shouldn't need to compile Perl. Just get the
latest release of ActivePerl or IndigoPerl. I had to upgrade the Perl distro
on one the servers at work for exactly the reason you note, and it only took
about ten minutes to uninstall the old version and install the new. Take a
look at perldelta for 5.8 and see if any of the changes affect the coding in
your scripts, but if all you're using is regexes than I doubt you'll run
into any issues upgrading. The only thing I would note is that you make a
list of all the non-core modules you're using (and going to need to
reinstall) *before* you upgrade to reduce the downtime.
Matt
------------------------------
Date: 21 Dec 2004 14:45:09 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: use external files as "HERE-docs" (and avoid the undefined substitions)
Message-Id: <Xns95C66336D5044asu1cornelledu@132.236.56.8>
"dede" <abrey@gmx.net> wrote in news:1103195035.162812.281040
@z14g2000cwz.googlegroups.com:
> c) Errors?
Dunno. Please quote the part of the post you are replying to and place
your replies below the original text. That way, people other than you can
figure out what you are replying to.
> Hmmm ... again .. 1st think then post - shame on me.
Exactly.
> The error is actually called
> "Use of uninitialized value in substitution iterator at
That is a warning.
Try
use diagnostics;
to get more information.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
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 7547
***************************************