[31472] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2724 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 16 14:09:41 2009

Date: Wed, 16 Dec 2009 11:09:07 -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 Dec 2009     Volume: 11 Number: 2724

Today's topics:
    Re: 2-headed strings and RExes <nospam-abuse@ilyaz.org>
    Re: Curious benchmark results with Inline::C <sisyphus359@gmail.com>
    Re: FAQ 5.3 How do I count the number of lines in a fil <derykus@gmail.com>
    Re: Get remote IP in self-calling script <dimke.fax@uni.de>
    Re: i18n - and 2-headed strings? <ams@sister.ludd.luth.se>
    Re: i18n - and 2-headed strings? <nospam-abuse@ilyaz.org>
    Re: i18n - and overloaded strings? <nospam-abuse@ilyaz.org>
    Re: perl compilers <brejen@gmail.com>
    Re: push integers from strings <john@castleamber.com>
    Re: push integers from strings <nospam-abuse@ilyaz.org>
    Re: push integers from strings charley@pulsenet.com
    Re: push integers from strings <user@example.net>
    Re: push integers from strings <uri@StemSystems.com>
    Re: push integers from strings <user@example.net>
    Re: push integers from strings <uri@StemSystems.com>
    Re: push integers from strings <jurgenex@hotmail.com>
    Re: Trying to avoid passing params to subs through glob <uri@StemSystems.com>
    Re: Trying to avoid passing params to subs through glob <source@netcom.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 16 Dec 2009 17:03:35 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: 2-headed strings and RExes
Message-Id: <slrnhii4n7.2tp.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-12-10, Ben Morrow <ben@morrow.me.uk> wrote:
> There is now. I submitted a patch to add 'qr' overloading to 5.12, which
> is called when an overloaded object is used on the RHS of =~ or is
> interpolated into a regex. Since 5.12 has true REGEX SVs, it seemed
> silly not to have a corresponding 'type-cast' overload.

Ah...  This is probably the reason why FreezeThaw is failing its tests
on 5.11...  Whoever added "true REx" SV did not fix the modules broken
by this change...

Ilya


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

Date: Wed, 16 Dec 2009 03:21:38 -0800 (PST)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: Curious benchmark results with Inline::C
Message-Id: <ae6908e9-3d57-41b1-aa5e-efe8e437bc1d@u36g2000prn.googlegroups.com>

On Dec 16, 11:35=A0am, "jl_p...@hotmail.com" <jl_p...@hotmail.com>
wrote:

>
> =A0 =A0So calling the C code that made use of an extra function call was
> actually faster! =A0But why is this so?
>

I don't have an answer, but I have experienced similar things myself.

With this particular code, howevever, I'm getting comparative results
that are more in line with what's expected:

                  Rate C with function   C with inline      C unrolled
C with function 1773/s              --            -38%            -39%
C with inline   2870/s             62%              --             -0%
C unrolled      2883/s             63%              0%              --

(I'm on Windows Vista - hence the ridiculously low number of
iterations per second.)

Cheers,
Rob


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

Date: Wed, 16 Dec 2009 08:06:08 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: FAQ 5.3 How do I count the number of lines in a file?
Message-Id: <48ffe7ef-f5da-4ec4-a7c2-e2e8fa19c201@u36g2000prn.googlegroups.com>

On Dec 16, 3:00=A0am, PerlFAQ Server <br...@theperlreview.com> wrote:
> This is an excerpt from the latest version perlfaq5.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is athttp://faq.perl.org.
>
> --------------------------------------------------------------------
>
> 5.3: How do I count the number of lines in a file?
>
> =A0 =A0 One fairly efficient way is to count newlines in the file. The fo=
llowing
> =A0 =A0 program uses a feature of tr///, as documented in perlop. If your=
 text
> =A0 =A0 file doesn't end with a newline, then it's not really a proper te=
xt
> =A0 =A0 file, so this may report one fewer line than you expect.
>
> =A0 =A0 =A0 =A0 =A0 =A0 $lines =3D 0;
> =A0 =A0 =A0 =A0 =A0 =A0 open(FILE, $filename) or die "Can't open `$filena=
me': $!";
> =A0 =A0 =A0 =A0 =A0 =A0 while (sysread FILE, $buffer, 4096) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $lines +=3D ($buffer =3D~ tr/\n//=
);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 close FILE;
>
> =A0 =A0 This assumes no funny games with newline translations.
>
> --------------------------------------------------------------------
>

Wasn't one of these one-liners included once?

perl -lne '}print $.;{'    file   # Abigail's trick
perl -lne 'END {print $.}' file

--
Charles DeRykus




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

Date: 16 Dec 2009 07:45:13 GMT
From: "Markus R." =?iso-8859-1?q?Ke=DFler?= <dimke.fax@uni.de>
Subject: Re: Get remote IP in self-calling script
Message-Id: <4b289009$0$6562$9b4e6d93@newsspool4.arcor-online.net>

Am Tue, 15 Dec 2009 19:41:15 -0600 schrieb John Bokma:

> "Markus R." Keßler <dimke.fax@uni.de> writes:
> 
>> Don't know exactly. And, in contrary to what
>>
>> http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts
>>
>> says, our ISP _IS_ able to provide SSL to every "v-host"- customer.
> 
> Then why do you have to use:
> 
> https://ssl1.fritsch-hosting.de/www.dipl-ing-kessler.de/cgi-bin/diary.pl
>              ^^^^^^^^^^^^^^^^^^
> 
> instead of
> 
> https://www.dipl-ing-kessler.de/cgi-bin/diary.pl
> 
> ;-). (Exactly!)[1]
> 
> Like I wrote: my best guess is that Fritsch Hosting uses
> ssl1.fritsch-hosting.de as a proxy for their customers to provide https
> which results in Apache connecting to dipl-ing-kessler.de, hence the
> address of the server showing up since ssl1.fritsch-hosting.de and
> www.dipl-ing-kessler.de are on the same server (correct?).
> 
> 
> 
> [1]
> www.dipl-ing-kessler.de uses an invalid security certificate.
> 
> The certificate is only valid for ssl1.fritsch-hosting.de

Hi!

Indeed, one can invoke a script like shown above on that machine.
I then get asked for confirming the unsigned certificate, which is valid 
for ssl.fritsch-hosting.de only, but when trying to load a real 
existing / working script there will occur a 404 error:

http://www.dipl-ing-kessler.de/cgi-bin/emailimg.pl

works,

https://ssl1.fritsch-hosting.de/www.dipl-ing-kessler.de/cgi-bin/
emailimg.pl

also works, but

https://www.dipl-ing-kessler.de/cgi-bin/emailimg.pl

does not. There arises a 404 error.

Best regards,

Markus

-- 
Please reply to group only.
For private email please use http://www.dipl-ing-kessler.de/email.htm


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

Date: Wed, 16 Dec 2009 13:36:48 +0000 (UTC)
From: Martin Str|mberg <ams@sister.ludd.luth.se>
Subject: Re: i18n - and 2-headed strings?
Message-Id: <hganpg$e9$1@aioe.org>

Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth Ilya Zakharevich <nospam-abuse@ilyaz.org>:
>> Anyway, this is a pipe dream.  The code DOES do $@ =~ /foo/.

> That is the problem, yes. 

I'm not a perl implementation hacker, but I have problems seeing the
problem.

We take that i18n module and make it a pragma (if it isn't
already). Or invent a new one. In my example below I've called this
pragma "i18n".

Then if "no i18n" is in effect, which is the default "$@" will be what
it always has been, i. e. in English.

However is a program/module uses the pragma "use i18n Swedish" or "use
i18n svenska" or whatever the syntax should be, then every "$@" in
this block/context (or whatever the term is) will suddenly be in
Swedish. And as the programmer added the "use i18n Swedish" he will be
aware of this so he will match "$@" on Swedish strings.


Perhaps this is already what that i18n module on CPAN does.

And the problem is in the perl implementation code there is a lot
matching "$Â@" on English strings, which are the strings I want to be
Swedish.


Hmm. Perhaps we should just make a perl wrapper (perlint?) that
translates the output from a perl program if it matches a perl error
message, like "perlint Swedish my_perl_script.pl"? Or perhaps only if
the exit status indicates failure?



MartinS


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

Date: Wed, 16 Dec 2009 17:00:27 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: i18n - and 2-headed strings?
Message-Id: <slrnhii4hb.2tp.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-12-16, Martin Str|mberg <ams@sister.ludd.luth.se> wrote:
>>> Anyway, this is a pipe dream.  The code DOES do $@ =~ /foo/.

> I'm not a perl implementation hacker, but I have problems seeing the
> problem.
>
> We take that i18n module and make it a pragma (if it isn't
> already). Or invent a new one. In my example below I've called this
> pragma "i18n".

First question: do you understand difference between lexical and
dynamic scope?  If you do, which one is your pragma implementing, and
why would this help?

> However is a program/module uses the pragma "use i18n Swedish" or "use
> i18n svenska" or whatever the syntax should be, then every "$@" in
> this block/context (or whatever the term is) will suddenly be in
> Swedish.

What do you mean by "in this block/context"?  Created in this context?
Read in this context?

Do you understand that some $@ are created by Perl executable, and
some by scripts?  Which do you mean?

> And the problem is in the perl implementation code there is a lot
> matching "$Â@" on English strings, which are the strings I want to be
> Swedish.

Can't parse what you wanted to say...

Yours,
Ilya


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

Date: Wed, 16 Dec 2009 17:37:14 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: i18n - and overloaded strings?
Message-Id: <slrnhii6ma.2tp.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-12-11, Ben Morrow <ben@morrow.me.uk> wrote:
>> Good.  But what I was "hinting at" was the LHS of "=~" ...; which is a
>> string.  And "a string" != "a REx" (after appropriate overloading of != ;-)

> I think the most immediate response from p5p would be 'that's what the
> new ~~ operator is for, which is already overloadable', and in general I
> would agree that having two 'stringifications' was seriously confusing.
> However, since this is (just) for back-compat hacks, it's possible a
> case could be made. Maybe I should just do up a patch...

Myself, I would not be so quick.  As I see it, the problem with
designing a reasonable string-overloading framework is that I do not
have many SIGNIFICANTLY different models to serve as examples
applications of this framework.

I agree with Larry's estimate that "to implement a feature, I must
want it 3 times first".  Usually, three "orthogonal" applications
provide enough insight to design a pilot semantic.  However, I have
only 2.3 examples in mind:

  a) potentially infinite streams: consider
      $Pi = infinite_precision_Pi;
      print OK if $Pi =~ /123456789/;
     or consider
      $/ = qr/[1-9][0-9]{50}/;		# or something more vicious
      $in = <STDIN>;			# assume a pipe
      system $external_program;

     (in second example, we may want to gobble as few characters as
      possible while achieving the match for $/).

  b1) Strings with out-of-bound markup.  E.g., colored output to TTY;
      or *parsed* HTML streams (the string value is what you get by
      cut&paste, but all the formating info is there, just out-of-bound).

      You want to look for certains "features" (e.g., match RExes on
      in-bound content + some restrictions on out-of-bound - as in:
      find "foo|bar" at start of a "subdivision" [table cell, or div,
      or whatsit]).

  b2) Same, only not for read-only access, but for modification (as in
      my interview to Perl Journal).  E.g., suppose you want to
      translate a chunk of data from HTML to LaTeX *inplace* (i.e., as
      s/// is doing); the translation rules are very non-local; one
      must either

        re-gather all the non-local information at again and again at
        each point, or

	gather it once, put it in markup, and use "local structure of
	markup at every point" instead of re-gathering.

      After this, to do actual translation, one wants to do needed
      s/// without ruining the gathered non-local information.

      (This is essentially what I do in cperl-mode to facify RExes;
      the only difference is that in CPerl, I only touch out-of-bound
      part of content.  Consider the case when I need to use these
      markups to convert RExes from Perl syntax to Emacs syntax...)

      (As I said in the interview, Emacs has much better facilities
      for string processing than Perl.  One of the purposes of string
      overloading should be to narrow the gap.)

It would be wonderful if one could use "2-headed 2-language strings"
as the third application of string overloading.  The problem is that I
have no idea how one would like to EDIT such strings.

For example: on English strings, one could do something like
s/each/every/g; would one want to do s/$each/$every/ (with suitably
constructed $each and $every) on 2-language strings?  So far this
looks too silly to be a help in semantical design...

Hope this helps,
Ilya


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

Date: Wed, 16 Dec 2009 08:47:20 -0800 (PST)
From: Barry McClintock <brejen@gmail.com>
Subject: Re: perl compilers
Message-Id: <fd3eaff9-efc2-4bcc-98b7-fe52c4f6ebc6@p30g2000vbt.googlegroups.com>

On Dec 3, 8:11=A0pm, s...@netherlands.com wrote:
> On Thu, 03 Dec 2009 16:50:37 -0800, Keith Thompson <ks...@mib.org> wrote:
> >Robin <rob...@cnsp.com> writes:
> >> Anyone know of any good perl compilers for windows. I have searched
> >> and found no good ones.
>
> >Do you really need a *compiler*? =A0Perl is normally interpreted, not
> >compiled. =A0(Well, there's some compilation that goes on when you
> >invoke a Perl script/program, but it doesn't generate a .exe file.)
>
> >If you do need a compiler, why do you need it? =A0(Knowing will help us
> >to give you a meaningful answer to your question -- if there is one.)
>
> perl2exe is a good way to generate a self contained interpreter and
> your script into a nice useable exe for machines where perl isn't/won't b=
e
> installed.
>
> -sln

ActiveState has a remarkable tool called Perlapp which packages your
environment and your code into a *.exe.


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

Date: Tue, 15 Dec 2009 20:48:13 -0600
From: John Bokma <john@castleamber.com>
Subject: Re: push integers from strings
Message-Id: <87fx7beis2.fsf@castleamber.com>

monkeys paw <user@example.net> writes:

> Following code has quoted numbers in it, but i want
> just integers. What's easiest way?

>     } else {
>            push @allnums, $numstr;

             push @allnums,$numstr * 1

>     }
> }

Note that instead of

> my $nums ='30-32,34,50,54-56';

and processing this, you could do:

my @allnums = (30..32,34,50,54..56);

if you're just looking for an easier notation.

-- 
John Bokma

Read my blog: http://johnbokma.com/
Hire me (Perl/Python): http://castleamber.com/


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

Date: Wed, 16 Dec 2009 03:24:26 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: push integers from strings
Message-Id: <slrnhigkna.bg.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-12-16, monkeys paw <user@example.net> wrote:
>         for my $anum ($lower .. $upper) {
>             push @allnums, $anum;
>         }

Better use

    push @allnums, $lower .. $upper;

Ilya


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

Date: Tue, 15 Dec 2009 19:32:14 -0800 (PST)
From: charley@pulsenet.com
Subject: Re: push integers from strings
Message-Id: <1898c21f-e1e4-4033-9b9e-5dd1a9ea9453@3g2000vbp.googlegroups.com>

On Dec 15, 8:27=A0pm, monkeys paw <u...@example.net> wrote:
> Following code has quoted numbers in it, but i want
> just integers. What's easiest way?

You could also use Set::IntSpan, which does that sort of thing.

#!/usr/bin/perl
use strict;
use warnings;
use Set::IntSpan;
use Data::Dumper;

my $nums =3D'30-32,34,50,54-56';

my $set =3D Set::IntSpan->new( $nums );

my @nums =3D $set->elements();

print Dumper \@nums;


$VAR1 =3D [
          30,
          31,
          32,
          34,
          50,
          54,
          55,
          56
        ];


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

Date: Wed, 16 Dec 2009 00:46:49 -0500
From: monkeys paw <user@example.net>
Subject: Re: push integers from strings
Message-Id: <1eWdnefrOPfU6bXWnZ2dnUVZ_r5i4p2d@insightbb.com>

Ben Morrow wrote:
> Quoth monkeys paw <user@example.net>:
>> Following code has quoted numbers in it, but i want
>> just integers. What's easiest way?
> 
> You have an X-Y problem. This is where you are asking for X, because you
> think it is what you need for Y, but you are mistaken. What are you
> actually trying to do? There are very few circumstances in Perl where
> you need to care about a scalar's internal storage format (and all of
> those are considered unfixable bugs rather than features).
> 
> Ben
> 

The $num variable represents user input. If they enter 5-20 i
need to push all the integers in between on an array and then
process whatever else is entered in CSV form. I got around the problem
by doing


for (@allnums) {
push @allnums, ($numstr * 1); # Turns string to int easy way
}

Still not sure why original code had a quoted value e.g. '11'
instead of the number.


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

Date: Wed, 16 Dec 2009 00:52:32 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: push integers from strings
Message-Id: <87zl5jihy7.fsf@quad.sysarch.com>

>>>>> "mp" == monkeys paw <user@example.net> writes:

  mp> Ben Morrow wrote:
  >> Quoth monkeys paw <user@example.net>:
  >>> Following code has quoted numbers in it, but i want
  >>> just integers. What's easiest way?
  >> 
  >> You have an X-Y problem. This is where you are asking for X, because you
  >> think it is what you need for Y, but you are mistaken. What are you
  >> actually trying to do? There are very few circumstances in Perl where
  >> you need to care about a scalar's internal storage format (and all of
  >> those are considered unfixable bugs rather than features).
  >> 
  >> Ben
  >> 

  mp> The $num variable represents user input. If they enter 5-20 i
  mp> need to push all the integers in between on an array and then
  mp> process whatever else is entered in CSV form. I got around the problem
  mp> by doing


  mp> for (@allnums) {
  mp> push @allnums, ($numstr * 1); # Turns string to int easy way
  mp> }

huh?? perl doesn't need to convert strings to nums in general.

  mp> Still not sure why original code had a quoted value e.g. '11'
  mp> instead of the number.

did you read any of the followups? in particular the one about the
module that does this for you? lists of number ranges is an old format
and the problem has long been solved. use the module.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 16 Dec 2009 00:54:09 -0500
From: monkeys paw <user@example.net>
Subject: Re: push integers from strings
Message-Id: <lJqdnUxWWdyd67XWnZ2dnUVZ_iydnZ2d@insightbb.com>

John Bokma wrote:
> monkeys paw <user@example.net> writes:
> 
>> Following code has quoted numbers in it, but i want
>> just integers. What's easiest way?
> 
>>     } else {
>>            push @allnums, $numstr;
> 
>              push @allnums,$numstr * 1
> 
>>     }
>> }
> 
> Note that instead of
> 
>> my 


Users enter it this way, if i changed the string
as you suggest i guess i could use an eval:

$nums ='30-32,34,50,54-56';
$nums =~ s/\-/\s\.\.\s/;  # Spaces important

now $nums = 30 .. 32,34,50,54 .. 156

How could i eval $nums into an array so it
would equal 30,31,32,34, etc...

eval { @allnums = $nums }; # This definitely won't work

> 
> and processing this, you could do:
> 
> my @allnums = (30..32,34,50,54..56);
> 
> if you're just looking for an easier notation.
> 


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

Date: Wed, 16 Dec 2009 01:14:41 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: push integers from strings
Message-Id: <87iqc7igxa.fsf@quad.sysarch.com>

>>>>> "mp" == monkeys paw <user@example.net> writes:

  mp> Users enter it this way, if i changed the string
  mp> as you suggest i guess i could use an eval:

  mp> $nums ='30-32,34,50,54-56';
  mp> $nums =~ s/\-/\s\.\.\s/;  # Spaces important

  mp> now $nums = 30 .. 32,34,50,54 .. 156

  mp> How could i eval $nums into an array so it
  mp> would equal 30,31,32,34, etc...

  mp> eval { @allnums = $nums }; # This definitely won't work

USE THE MODULE!!!

lather. rinse. repeat.

you are not good enough to code this correctly. even with working code
given to you.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 15 Dec 2009 22:58:36 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: push integers from strings
Message-Id: <651hi5li0buuh61ad5flrh845mttsrdk0d@4ax.com>

monkeys paw <user@example.net> wrote:
>Ben Morrow wrote:
>The $num variable represents user input. If they enter 5-20 i
>need to push all the integers in between on an array 

my ($low, $high) = split /-/, $num;
push @array, $low..$high;

jue


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

Date: Tue, 15 Dec 2009 22:00:07 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Trying to avoid passing params to subs through globals
Message-Id: <87tyvrk4i0.fsf@quad.sysarch.com>

>>>>> "BM" == Ben Morrow <ben@morrow.me.uk> writes:

  BM> Quoth "Uri Guttman" <uri@StemSystems.com>:
  >> 
  >> i have seen too many subs which return undef on fail. in older perls
  >> that is problematic with ||.

  BM> Can you explain how? AFAIK undef has always been false...

because you can't tell undef from '' or 0 or '0' with ||. 5.10 has //
which solves that problem.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 16 Dec 2009 10:35:58 -0800
From: David Harmon <source@netcom.com>
Subject: Re: Trying to avoid passing params to subs through globals
Message-Id: <q5-dnX5Q3N5QtbTWnZ2dnUVZ_hSdnZ2d@earthlink.com>

On Tue, 15 Dec 2009 22:00:07 -0500 in comp.lang.perl.misc, "Uri Guttman"
<uri@StemSystems.com> wrote,
>>>>>> "BM" == Ben Morrow <ben@morrow.me.uk> writes:
>
>  BM> Quoth "Uri Guttman" <uri@StemSystems.com>:
>  >> 
>  >> i have seen too many subs which return undef on fail. in older perls
>  >> that is problematic with ||.
>
>  BM> Can you explain how? AFAIK undef has always been false...
>
>because you can't tell undef from '' or 0 or '0' with ||. 5.10 has //
>which solves that problem.

But that's not a problem in this thread, where undef is completely
acceptable as a false result from a sub indicating failure.  When you
wrote that undef was problematic with || I took that as meaning that it
didn't always work as documented in older perls.  After searching, I can
find no indication of that being true.  So it is not problematic; it
just doesn't always do everything you might imagine.

In another thread you suggest:
    my $month = $ARGV[0] || '' ;

How are you supposed to distinguish month 0 from a missing arg in that
case?



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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 2724
***************************************


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