[23505] in Perl-Users-Digest
Perl-Users Digest, Issue: 5715 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 27 09:10:44 2003
Date: Mon, 27 Oct 2003 06:10:18 -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 Mon, 27 Oct 2003 Volume: 10 Number: 5715
Today's topics:
Re: Portable @INC (William Herrera)
Printing folder contents <mh>
Re: Printing folder contents <kaspREMOVE_CAPS@epatra.com>
Re: Printing folder contents <usenet@morrow.me.uk>
Re: Printing folder contents <mh>
Problem with printing hashes using dynamic keys (Palaniappan)
Re: Problem with printing hashes using dynamic keys (Anno Siegel)
Re: Problem with printing hashes using dynamic keys <nobull@mail.com>
Re: Problem with printing hashes using dynamic keys (Tad McClellan)
Question (Kobe Clinton)
Re: Question <nospam@bigpond.com>
Re: Question <jwillmore@remove.adelphia.net>
Rounding a float in Perl? <jon.rogers@tv.tu>
Re: Rounding a float in Perl? <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: Rounding a float in Perl? (Anno Siegel)
Re: Rounding a float in Perl? <bart.lateur@pandora.be>
Re: SendMail Problem (David Efflandt)
Re: SendMail Problem <jwillmore@remove.adelphia.net>
Re: SendMail Problem (VK4TEC\)
Re: strange effect with [:lower:] in perl (T. Sander)
Re: strange effect with [:lower:] in perl (Anno Siegel)
Re: Use in if..elsif <smario@rol.ru>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 27 Oct 2003 04:11:13 GMT
From: wherrera@lynxview.com (William Herrera)
Subject: Re: Portable @INC
Message-Id: <3f9c9a78.4653107@news2.news.adelphia.net>
On 26 Oct 2003 08:36:25 -0800, tjdevil@netbuilder.eu.com (Tielman de Villiers)
wrote:
>The idea is to compile the "portable perl" only once, tarball it, and
>then expand the tarball in all the users' home dirs -- the "portable
>perl" should then "automatically" / "dynamically" know that it is in,
>say, "/home/usera" or "/home/userb" and have a corresponding @INC.
>This is very do-able by prepending to @INC through "use lib" or
>running /path/to/perl -I/path/to/auser, but I want to know if it can
>be "hard-coded" into the compiled perl.
Don't make your work harder than needed :).
You should just work out a way to redefine the environment variable PERL5LIB
for each user, prior to the time the user runs perl.
See perlrun:
PERL5LIB
A colon-separated list of directories in which to look for Perl library files
before looking in the standard library and the current directory. Any
architecture-specific directories under the specified locations are
automatically included if they exist. If PERL5LIB is not defined, PERLLIB is
used.
---
Use the domain skylightview (dot) com for the reply address instead.
------------------------------
Date: Mon, 27 Oct 2003 13:57:15 +0200
From: <mh>
Subject: Printing folder contents
Message-Id: <3f9d0827$1@news.dnainternet.net>
I'.m trying to make a simple program which would print the contents of c:\
folder.
(files and first sub-folders). Am i at the right track? (this doesn't work)
#!/usr/bin/perl
use strict;
print "Content-Type: text/plain\n\n";
my @folder = <c:\*>;
foreach my $file (@folder)
{
print "$file\n";
}
# end
------------------------------
Date: Mon, 27 Oct 2003 17:35:57 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Printing folder contents
Message-Id: <bnj1nb$b2a$1@newsreader.mailgate.org>
> I'.m trying to make a simple program which would print the contents of c:\
> folder.
> (files and first sub-folders). Am i at the right track? (this doesn't
work)
>
> #!/usr/bin/perl
I assume you are running this script on a Windows machine. So the above line
doesn't make much sense.
> use strict;
> print "Content-Type: text/plain\n\n";
> my @folder = <c:\*>;
Escape the '\' like this
my @folder = <c:\\*>;
> foreach my $file (@folder)
> {
> print "$file\n";
> }
Does your script work at command prompt? Try that first before you go into
making a CGI.
HTH
Kasp.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 27 Oct 2003 12:07:15 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Printing folder contents
Message-Id: <bnj1pj$1dq$1@wisteria.csv.warwick.ac.uk>
<mh> wrote:
> I'.m trying to make a simple program which would print the contents of c:\
> folder.
> (files and first sub-folders). Am i at the right track? (this doesn't work)
>
> #!/usr/bin/perl
> use strict;
Good; you want to add
use warnings;
to that.
> print "Content-Type: text/plain\n\n";
Why? Perl != CGI.
> my @folder = <c:\*>;
When using Perl, always use / rather than \ for paths.
> foreach my $file (@folder)
> {
> print "$file\n";
> }
> # end
The usual Perl way to indicate end-of-program is
__END__
because perl understands that as well.
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: Mon, 27 Oct 2003 14:23:33 +0200
From: <mh>
Subject: Re: Printing folder contents
Message-Id: <3f9d0e41$1@news.dnainternet.net>
Thank you, the problem was only this
<c:\*>; => <c:\\*>;
> > #!/usr/bin/perl
>
> I assume you are running this script on a Windows machine. So the above
line
> doesn't make much sense.
>
> > use strict;
> > print "Content-Type: text/plain\n\n";
> > my @folder = <c:\*>;
>
> Escape the '\' like this
> my @folder = <c:\\*>;
>
> > foreach my $file (@folder)
> > {
> > print "$file\n";
> > }
>
> Does your script work at command prompt? Try that first before you go into
> making a CGI.
> HTH
> Kasp.
> --
> "Accept that some days you are the pigeon and some days the statue."
> "A pat on the back is only a few inches from a kick in the butt." -
Dilbert.
>
>
------------------------------
Date: 27 Oct 2003 04:48:40 -0800
From: palam_analog@yahoo.co.in (Palaniappan)
Subject: Problem with printing hashes using dynamic keys
Message-Id: <a7b604a1.0310270448.4ba66c84@posting.google.com>
Hi,
I am a newbie, sorry if my doubt is very basic..
i am having a hash %abc with keys as
$abc{'a0'}, $abc{'a1'}, .... $abc{'a9'}
and i wrote a for loop to print all 10 values..
for($i=0;$i<10;$i++)
{ print "$i - $abc{"a$i"} "; }
i got the problem of using "" in between the string...
how to solve the problem without using extra variable?
-palam
------------------------------
Date: 27 Oct 2003 13:05:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with printing hashes using dynamic keys
Message-Id: <bnj56b$i76$2@mamenchi.zrz.TU-Berlin.DE>
Palaniappan <palam_analog@yahoo.co.in> wrote in comp.lang.perl.misc:
> Hi,
> I am a newbie, sorry if my doubt is very basic..
>
> i am having a hash %abc with keys as
>
> $abc{'a0'}, $abc{'a1'}, .... $abc{'a9'}
Simple strings in hash braces don't have to be quoted. You could write
that
$abc{a0}, $abc{a1}, .... $abc{a9}
> and i wrote a for loop to print all 10 values..
>
> for($i=0;$i<10;$i++)
Better written as
for my $i ( 0 .. 9 )
Use lexical variables per default.
> { print "$i - $abc{"a$i"} "; }
>
> i got the problem of using "" in between the string...
Use concatenation instead. (Perl uses it anyhow, string interpolation
is just concatenation in disguise.)
print "$i - $abc{'a' . $i} ";
Anno
------------------------------
Date: 27 Oct 2003 13:05:35 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Problem with printing hashes using dynamic keys
Message-Id: <u9d6ci3k68.fsf@wcl-l.bham.ac.uk>
palam_analog@yahoo.co.in (Palaniappan) writes:
> and i wrote a for loop to print all 10 values..
>
> for($i=0;$i<10;$i++)
> { print "$i - $abc{"a$i"} "; }
>
> i got the problem of using "" in between the string...
>
> how to solve the problem without using extra variable?
Use qq() so that you can choose some character other than "" for
delimiting one of your interpolated strings.
Or use backslash to protect the inner "".
Or use explicit concatenation rather than interpolation.
I consider the use of backslash in this context totally
counter-intuative. To understand why it work at all see: Gory details
of parsing quoted constructs.
Note: use of C-style for() in Perl where it is not needed is generally
considered un-Perl-ish.
Note: you should always delcare all varaibles as lexically scoped in
the smallest applicable scope unless you have a reson not to. This is
not perculliar to Perl - it applies in all languages with the concept
of lexically scoped variables exists.
for my $i ( 0 .. 9 ) {
print qq'$i - $abc{"a$i"}\n';
print "$i - $abc{qq{a$i}}\n";
print "$i - $abc{'a'.$i}\n";
print "$i - $abc{\"a$i\"}\n";
}
Note: The fact that you want to do this in the first place may mean
you are using the wrong structure. A single element in the hash
holding an arrayref could well be the more natural reprecentation of
your data.
for my $i ( 0 .. $#{$abc{a}} ) {
print "$i - $abc{a}[$i]\n";
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 27 Oct 2003 07:51:26 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problem with printing hashes using dynamic keys
Message-Id: <slrnbpq8mt.bdg.tadmc@magna.augustmail.com>
Palaniappan <palam_analog@yahoo.co.in> wrote:
> I am a newbie,
Please see the Posting Guidelines that are posted here frequently.
It will help you get answers to your Perl questions.
> sorry if my doubt is very basic..
There is no need to apologize for basic questions.
(There _is_ a need to apologize for questions answered in the
std docs though, but you didn't do that.)
> i am having a hash %abc with keys as
>
> $abc{'a0'}, $abc{'a1'}, .... $abc{'a9'}
Sequentially numbered hash keys may indicate that you've chosen
the wrong data structure. An array is often better in such cases...
> and i wrote a for loop to print all 10 values..
>
> for($i=0;$i<10;$i++)
That is an error-prone way of indexing, see below for a Better Way.
Space characters are not a scarse resource, feel free to use as
many of them as you need to make your code easier to read and understand.
for( $i=0; $i<10; $i++ )
> { print "$i - $abc{"a$i"} "; }
>
> i got the problem of using "" in between the string...
Here are 4 ways doing what you want, and one way that suggests
you try to want something else :-)
---------------------------------
#!/usr/bin/perl
use strict;
use warnings;
my %abc = qw/ a0 zero a1 one a2 two a3 three a4 four a5 five a6 six
a7 seven a8 eight a9 nine /;
foreach my $i ( 0 .. 9 ) {
print "$i - $abc{'a' . $i}\n"; # concatenation
print "$i - ", $abc{"a$i"}, "\n"; # list of args to print()
print qq/$i - $abc{"a$i"}\n/; # alternate delimiters
print "$i - $abc{ qq/a$i/ }\n"; # other alternate delimiters
}
print "-----\n";
foreach my $i ( 'a0' .. 'a9' ) { # range using magic auto-increment
print "$i - $abc{$i}\n";
}
print "-----\n";
---------------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Oct 2003 19:45:42 -0800
From: kapavars@yahoo.com (Kobe Clinton)
Subject: Question
Message-Id: <52ea746.0310261945.67ae8f70@posting.google.com>
I would like to know if there is a perl module that would actually
help me send gif, gpeg files(like company logos) through Perl.
I am able to use net::smtp to generate mails containg text
information, however I would like to add company logo in every mail I
send.
Please let me know
Thanks
------------------------------
Date: Mon, 27 Oct 2003 14:03:04 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Question
Message-Id: <1178845.Vh11eZrEDu@gregs-web-hosting-and-pickle-farming>
It was a dark and stormy night, and Kobe Clinton managed to scribble:
> I would like to know if there is a perl module that would actually
> help me send gif, gpeg files(like company logos) through Perl.
> I am able to use net::smtp to generate mails containg text
> information, however I would like to add company logo in every mail I
> send.
> Please let me know
>
> Thanks
Didn't you trust the previous answer?
Here is a MIME:Lite example for sending HTML which may solve your problem. Also have a look at the doco for attaching a file, in your case a gif file.
#!/usr/bin/perl
use strict;
require MIME::Lite;
require MIME::Lite::HTML;
my $msg;
$msg = MIME::Lite->new(
To =>'gmtoomey@testurl.com',
From =>'newsletter@sadasdasd.com.au',
Subject =>'HTML with in-line images!',
Type =>'multipart/related'
);
$msg->attach(Type => 'text/html',
Data => qq{ <body>
Here's <i>my</i> image:
<img src="http://asdasd.com.au/images/asdasd.gif">
</body> }
);
$msg->send;
------------------------------
Date: Mon, 27 Oct 2003 09:00:06 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Question
Message-Id: <20031027040005.5141ed51.jwillmore@remove.adelphia.net>
On 26 Oct 2003 19:45:42 -0800
kapavars@yahoo.com (Kobe Clinton) wrote:
> I would like to know if there is a perl module that would actually
> help me send gif, gpeg files(like company logos) through Perl.
> I am able to use net::smtp to generate mails containg text
> information, however I would like to add company logo in every mail
> I send.
> Please let me know
Hummm ... I'm thinking you _may_ have read this before, but ....
MIME::Lite. MIME::Lite::HTML.
To _create_ images, you coulde use GD.
You _could_ also use Net::SMTP or other email modules, but it's, IMHO,
a royal pain.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
As long as the answer is right, who cares if the question is
<wrong?
------------------------------
Date: Mon, 27 Oct 2003 09:04:16 +0100
From: jon rogers <jon.rogers@tv.tu>
Subject: Rounding a float in Perl?
Message-Id: <bnimib$38$1@news.gu.se>
Hi
Is there any good way to round a float into n decimals in Perl?
I'd like to see
round($float,5); # rounds $float to (at most) 5 decimal digits
which would turn
1.234446732653623
into
1.23445
(or some equivalent functionality)?
Thanks for your time,
JR
------------------------------
Date: Mon, 27 Oct 2003 09:04:40 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Rounding a float in Perl?
Message-Id: <Xns9421664BA7A04elhber1lidotechnet@62.89.127.66>
jon rogers <jon.rogers@tv.tu> wrote in news:bnimib$38$1@news.gu.se:
> Hi
>
> Is there any good way to round a float into n decimals in Perl?
>
> I'd like to see
>
> round($float,5); # rounds $float to (at most) 5 decimal digits
[...]
perldoc -q round
Cheers,
Bernard
------------------------------
Date: 27 Oct 2003 11:27:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Rounding a float in Perl?
Message-Id: <bnivfs$i76$1@mamenchi.zrz.TU-Berlin.DE>
Bernard El-Hagin <bernard.el-haginDODGE_THIS@lido-tech.net> wrote in comp.lang.perl.misc:
> jon rogers <jon.rogers@tv.tu> wrote in news:bnimib$38$1@news.gu.se:
>
> > Hi
> >
> > Is there any good way to round a float into n decimals in Perl?
> >
> > I'd like to see
> >
> > round($float,5); # rounds $float to (at most) 5 decimal digits
>
> [...]
>
>
> perldoc -q round
The FAQ answer is "use sprintf()", which is fine in most cases. It
must be said, however, that sprintf() is a slow function, and if a
lot of rounding is going on it can easily dominate the calculation.
Even a pure Perl rounding function, along the lines of
sub round {
my $x = shift;
my $y = 0.5 + abs $x;
my $abs = int $y;
$abs -= $abs % 2 if $y == $abs;
($x <=> 0) * $abs;
}
is twice as fast, and a compiled rounding function can be ten times
as fast.
Anno
------------------------------
Date: Mon, 27 Oct 2003 11:50:03 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Rounding a float in Perl?
Message-Id: <6g1qpv4hlgpv18688po8corht5aj0hvd4t@4ax.com>
jon rogers wrote:
>Is there any good way to round a float into n decimals in Perl?
>
>I'd like to see
>
>round($float,5); # rounds $float to (at most) 5 decimal digits
>
>which would turn
>1.234446732653623
>into
>1.23445
sprintf
$float = 1.234446732653623;
$rounded = sprintf "%.5f", $float;
print $rounded;
However, that doesn't remove unnecessary trailing zeroes, or the decimal
point for integers.
--
Bart.
------------------------------
Date: Mon, 27 Oct 2003 06:12:42 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: SendMail Problem
Message-Id: <slrnbppdqq.lr3.efflandt@typhoon.xnet.com>
On Sun, 26 Oct 2003 04:21:12 GMT, jim <defenderjim4@no_spam_juno.com> wrote:
> Hey,
>
>>I can't help with that part, other than checking for
> Well, that was it.
> Thank you for the input.
>
>
> Now the weird part is that I am receiving two email messages.
> I am only sending one. Very strange.
I suspect your $touser is not formatted properly. Is it in single or
double quotes? If in double quotes, did you escape the @? Does it
contain anything other than e-mail address (real name)?
>>You should always prefer lexical (my) variables over dynamic (local)
>>variables, except when you can't.
> Yep, you certainly are correct. <lame excuse>...Long story.... Legacy
> code I inherited... Under time pressure to be done w/this project.</lame
> excuse>
>
>
>> my($fromuser, $touser, $subject, $messagebody) = @_;
>> die "newlines in address" if grep /\n/, $fromuser, $touser;
> Made changes to code.
>
>> $ENV{ENV} = "";
>> Do you have taint checking turned on or something?
> Yes.
>
--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Mon, 27 Oct 2003 08:46:29 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: SendMail Problem
Message-Id: <20031027034628.5d8710d2.jwillmore@remove.adelphia.net>
On Sun, 26 Oct 2003 15:42:40 GMT
jim <defenderjim4@no_spam_juno.com> wrote:
> James,
>
> > Have you considered using the many email modules available in
> > Perl? I know this doesn't directly answer your question, but I
> > find this a
> No, have not considered this. I am an experienced programmer, but
> very new to Perl. I am just trying to get code working that I was
> given, so I have tended to look at the leafs, not the forest.
>
> Suggestions?
Net::SMTP is a good one. So is MIME::Lite.
Mail::Mailer, if I not mistaken, comes with the standard with Perl.
Visit http://search.cpan.org/ . There, you can search for email
modules and read the documentation before using the modules - which is
something I highly recommend before using them; or even installing
them. If I can follow the documentation _before_ installing the
module, then chances are I can use the module successfully.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
What I tell you three times is true.
------------------------------
Date: Mon, 27 Oct 2003 19:05:52 +1000
From: "Andrew Rich \(VK4TEC\)" <vk4tec@hotmail.com>
Subject: Re: SendMail Problem
Message-Id: <3f9cdffe_1@news.iprimus.com.au>
#!/usr/bin/perl
use Net::SMTP;
$from = 'barry@hotmail.com';
$to = 'barry@hotmail.com';
$subject = 'Updated web site';
$smtp = Net::SMTP->new('smtp.dogo.com.au',Debug=>0);
$smtp->mail($email);
$smtp->to($to);
$smtp->data();
$smtp->datasend("To: $to\n");
$smtp->datasend("From: $email\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("Date: Sun, 12 Oct 2003 10:55:55 -0500\n");
$smtp->datasend("www.software.net\n");
$smtp->dataend();
sleep 5;
print "$email\n";
$smtp->quit;
------------------------------
Date: 27 Oct 2003 05:04:46 -0800
From: roetz7@unicum.de (T. Sander)
Subject: Re: strange effect with [:lower:] in perl
Message-Id: <1b27f62d.0310270504.242cac55@posting.google.com>
Abigail <abigail@abigail.nl> wrote in message news:<slrnbpfrhv.ib0.abigail@alexandra.abigail.nl>...
> T. Sander (roetz7@unicum.de) wrote on MMMDCCV September MCMXCIII in
> <URL:news:1b27f62d.0310230630.46157fd4@posting.google.com>:
> ** I have a strange problem with the following perl code.
> ** It produces the output :
> **
> ** A : dEf
> ** B : dBf
> ** D : DbF
> **
> ** Why is there no output for the case C?
> **
> ** This must be a bug or what is the explanation for this behaviuor?
> ** When I change $c to "DgF" I get the output line for C.
> ** I think the problem always occur for lower when the lower character is the
> ** successor of the upper-case character.
> ** Why this doesn't happen with the same upper variant?
> **
> ** I have tested this with different perl version 5.5, 5.8 on Solaris and Windows.
> **
> ** --------------------
> ** $a="dEf";
> ** $b="dBf";
> **
> ** if (not ($a=~/[:upper:]/)) {
> ** print "A : $a\n";}
> **
> **
> ** if (not ($b=~/[:upper:]/)) {
> ** print "B : $b\n";}
> **
> **
> ** $c="DeF";
> ** $d="DbF";
> **
> ** if (not ($c=~/[:lower:]/)) {
> ** print "C : $c\n";}
> **
> ** if (not ($d=~/[:lower:]/)) {
> ** print "D : $d\n";}
> **
>
> /[:lower:]/ matches if the string contains a ':', an 'l', an 'o', a 'w',
> an 'e' or an 'r'. "DeF" contains an 'e', so it does match.
>
> What you probably want is /[[:lower:]]/.
>
>
> Abigail
Thank you for your reply. Now it works.
But why have I to use two [?
Where is the difference between [a-z] and [:lower:]? For [a-z] I get the range
of letters and not only 'a','-' and 'z'. Why not the same for [:lower:]?
In which case can I use only [:lower:] without an additional [] pair?
------------------------------
Date: 27 Oct 2003 13:17:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: strange effect with [:lower:] in perl
Message-Id: <bnj5so$i76$3@mamenchi.zrz.TU-Berlin.DE>
T. Sander <roetz7@unicum.de> wrote in comp.lang.perl.misc:
> Abigail <abigail@abigail.nl> wrote in message
> news:<slrnbpfrhv.ib0.abigail@alexandra.abigail.nl>...
> > T. Sander (roetz7@unicum.de) wrote on MMMDCCV September MCMXCIII in
> > <URL:news:1b27f62d.0310230630.46157fd4@posting.google.com>:
[...]
> > /[:lower:]/ matches if the string contains a ':', an 'l', an 'o', a 'w',
> > an 'e' or an 'r'. "DeF" contains an 'e', so it does match.
> >
> > What you probably want is /[[:lower:]]/.
> >
> >
> > Abigail
>
>
>
> Thank you for your reply. Now it works.
> But why have I to use two [?
"Why" isn't a sensible question to ask at this point. The only possible
answer is, "Because whoever implemented it made it that way". About the
reasons we can only speculate.
> Where is the difference between [a-z] and [:lower:]? For [a-z] I get the range
> of letters and not only 'a','-' and 'z'. Why not the same for [:lower:]?
That would have introduced ":" as a new metacharacter in character classes,
breaking old programs.
> In which case can I use only [:lower:] without an additional [] pair?
You can't. The [:<anything>:] construct is only valid inside character
classes.
Anno
------------------------------
Date: Mon, 27 Oct 2003 09:37:50 +0600
From: "Andrey" <smario@rol.ru>
Subject: Re: Use in if..elsif
Message-Id: <bni3ud$b7c$1@news.rol.ru>
Hello!
> > It's working, but in some strange manner, I need to reload page few
times to
> > make it works, before that I see module export errors in log.
> Restarting the server will fix it, as will using one of the reload on
change
> modules (at some runtime cost).
Of course I restarted server.
------------------------------
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 5715
***************************************