[21820] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4024 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 24 14:05:38 2002

Date: Thu, 24 Oct 2002 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 24 Oct 2002     Volume: 10 Number: 4024

Today's topics:
    Re: Adding a word to a list if it is not already in the <tknox@flytechnology.com>
    Re: calling an external script within a script? <flavell@mail.cern.ch>
        CGI Question - can't differenciate between mutlipe subm <tim@nonspam_melonhead.net>
    Re: DBI module INSERT command problem (Andrew Perrin (CLists))
        Difference between @foo = <`some program`> and @foo = ` (Tipu)
    Re: Difference between @foo = <`some program`> and @foo (Tad McClellan)
    Re: File access in CGI <cpryce@pryce.net>
        Mappoint via Perl (David Hiskiyahu)
        Missing WRITE_DAC event to audit in Registry.pm a246456@fmr.com
    Re: perl bug? "eq" less restrictive then  "=="? ctcgag@hotmail.com
    Re: perl bug? "eq" less restrictive then  "=="? <rereidy@indra.com>
    Re: Perl Calling C issues?? (Bryan Castillo)
        PL_Sv error (Gregg Palmer)
    Re: regular expression ctcgag@hotmail.com
    Re: regular expression <pinyaj@rpi.edu>
    Re: sendmail question (Rodney Engdahl)
    Re: Trying to make a GUI. (Helgi Briem)
    Re: Trying to make a GUI. <wksmith@optonline.net>
        Why are empty tailing elements missing from the array r <zzhang1@bcm.tmc.edu>
    Re: Why are empty tailing elements missing from the arr (Tad McClellan)
    Re: Why are empty tailing elements missing from the arr <pinyaj@rpi.edu>
    Re: Yet Another Perl Wrinkle!!! <mjcarman@mchsi.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 24 Oct 2002 13:01:19 -0500
From: Timothy Knox <tknox@flytechnology.com>
Subject: Re: Adding a word to a list if it is not already in there
Message-Id: <3db8334d$0$949$39cecf19@nnrp1.twtelecom.net>

Somewhere on Basilisk Station, on Thursday October 24 2002 03.34, The 
Honorable Yils Kraabe wrote:

> 
> Hello,
> 
> I want to add a (list of) words to a list, if this word in not already
> in there. I did something very C-like, with a flag:
> 
> for $newword (@newwords) {
>   $flag = 1;
>   for $word (@words) {
>     $flag = 0 if $newword eq $word
>   }
>   $words[@words] = $newword if $flag;
> }
> 
> However it looks pretty ugly to me. Maybe is there a "shell"-like
> solution using sort and something similar to uniq, or something else,
> that could improve this laborious code.
> 
> Thanks again.
> 
I would do something like:
for (@newwords) {
        $words{$_} = 1;
}

for (sort keys %words) {
        print "$_\n";
}

-- 
Timothy Knox
#include <std/disclaimer.h>
"There are some people who think all black people look
alike. We call those people cops." -- Dave Chappelle


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

Date: Thu, 24 Oct 2002 17:48:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: calling an external script within a script?
Message-Id: <Pine.LNX.4.40.0210241736230.30678-100000@lxplus074.cern.ch>

On Oct 24, peter pilsl inscribed on the eternal scroll:

> of course you can directly read the output of any tool without need to
> write to a file first !!

I don't think you understand the more general meaning of the
term "file" in unix-ish contexts.

Files don't _have_ to be magnetic disturbances on rotating media.

> (This is the meaning of piping)

One kind of file is indeed a pipe.




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

Date: Wed, 23 Oct 2002 08:06:40 +0100
From: "melonhead" <tim@nonspam_melonhead.net>
Subject: CGI Question - can't differenciate between mutlipe submit buttons
Message-Id: <1035480279.80507.0@iapetus.uk.clara.net>

This isn't strictly a perl question, but I've poseted in the hope that
someone will be aple to help.

I want to have a form which will have several submit buttons on that each
appears on the screen to have the same label.  For example there would be 6
lines of text boxes, each with a button called modify at the end to submit
that particular line to a CGI program.

From what I can see the setting for the button's label is also the value
that it returns when clicked, so it would be impossible to differenciate
between any of them.

Then I thought, why not have a different label for each, but have an image
on each button that would give the appearance that they are the same -
problem, when one button is clicked it returns the image from all of the
buttons!!

Below is the HTML & Perl, if any one can help I'd greatly appreciate it.


regards,

<html><form action="http://www.test.com/cgi-bin/test.cgi" method="post">
<head><title>TEST</title></head>
<body>

<p><INPUT TYPE="text" NAME="MODIFY1" SIZE="25" Value="" tabindex="1">
<BUTTON type="submit" value="BMODIFY1" name="BMODIFY1">
<IMG ALT="modifybutton" src="http://www.test.com/images/ModifyButton.gif"
width="55" height="21">
</BUTTON></p>

<p><INPUT TYPE="text" NAME="DELETE1" SIZE="25" Value="" tabindex="1">
<BUTTON type="submit" value="BDELETE1" name="BDELETE1">
<IMG ALT="deletebutton" src="http://www.test.com/images/DeleteButton.gif"
width="55" height="21">
</BUTTON></p>

</form></body></html>



#!c:/perl/bin/perl.exe -w

use CGI qw(:standard);

@inputdata = (param('MODIFY1'), param('BMODIFY1'),
param('DELETE1'),param('BDELETE1'));

print header;
print "@inputdata\n";




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

Date: 24 Oct 2002 11:27:41 -0400
From: clists@perrin.socsci.unc.edu (Andrew Perrin (CLists))
Subject: Re: DBI module INSERT command problem
Message-Id: <84u1jbluvm.fsf@perrin.socsci.unc.edu>

"Doug" <dgardiner@houston.rr.com> writes:

> So what did you do to speed it up?  Did you add the table names to the field
> names like I have seen in the SQL view?  I'm not gonna split hairs by saying
> that it included it and bracketized everything, but that is different
> syntax, even though the SQL syntax as far as the INSERT command still
> required the same parameters as is the same.

The basic issue there was that there was a series of very complicated
JOINs that couldn't be represented well in the GUI.  (Unfortunately I
don't remember the particulars - it was several years ago.)  I
actually wrote the query by hand, then made the mistake of trying to
"view" it using the GUI. That caused Access to rewrite the SQL to
match its GUI representation, which involved an enormous number of
nested SELECTs.

ap

-- 
----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu


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

Date: 24 Oct 2002 10:21:44 -0700
From: jandirb@hotmail.com (Tipu)
Subject: Difference between @foo = <`some program`> and @foo = `some program` ??
Message-Id: <ab341de3.0210240921.7d9e0e54@posting.google.com>

Anyone know how the two are different?? I used to use the former but
for certain situations only the latter works.

Thank you


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

Date: Thu, 24 Oct 2002 12:35:30 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Difference between @foo = <`some program`> and @foo = `some program` ??
Message-Id: <slrnargbr2.1mq.tadmc@magna.augustmail.com>

Tipu <jandirb@hotmail.com> wrote:

> Anyone know how the two are different?? 


   @foo = <`some program`>

I dunno what that does, filename glob()ing perhaps.


   @foo = `some program`

Puts the output of "some program" into the @foo array, one output
line per array element.


> I used to use the former but


How did you use it?

That first one looks non-sensical to me.

I'm not seeing how it could ever have "worked". Enlighten me.


> for certain situations only the latter works.
                                         ^^^^^

"works" depends on what it is that you _want_ to do.

Do you want to capture the output or do you want to do glob()ing?



-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 24 Oct 2002 10:15:33 -0500
From: cp <cpryce@pryce.net>
Subject: Re: File access in CGI
Message-Id: <B9DD78C5.10A07%cpryce@pryce.net>

in article 
Pine.LNX.4.05.10210241504280.15729-100000@krypton.wi.leidenuniv.nl,
Christian C Schouten at cschoute@liacs.nl wrote on 10/24/02 8:17 AM:

> Sorry to ask again, but I'm still having problems accessing a file from a
> CGI interface form. In short, what I need to do is to have a user fill in
> a form on a publicly accessible web site. This form script will then open
> a file on the web server for reading/writing. My problem is that
> everything seems to be fine, but the script just won't open the file.
> My script is located at http://www.liacs.nl/~cschoute/let/survey_ICT.cgi
> (source visible as survey_ICT.txt). A minimal version is available as
> short.cgi / short.txt.

See http://stein.cshl.org/WWW/software/CGI/#upload
Pay special attention to the explanation of start_multipart_form()

cp



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

Date: 24 Oct 2002 08:47:13 -0700
From: David.Hiskiyahu@brinksinc.com (David Hiskiyahu)
Subject: Mappoint via Perl
Message-Id: <b07846ff.0210240747.3119299c@posting.google.com>

Does anybody know of a Perl module which can do stuff similar to what Mappoint
of MicroSoft does, or (probably better) which can interface with Mappoint?

Mappoint (http://www.microsoft.com/mappoint/net/) looks to me like a nice way
to get rid of tedous work of designing and manipulating maps. I saw that they
can interwork with ASP pages, hope there is a way to use the stuff through Perl.


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

Date: Thu, 24 Oct 2002 13:38:29 -0400
From: a246456@fmr.com
Subject: Missing WRITE_DAC event to audit in Registry.pm
Message-Id: <3DB83015.95FB5141@fmr.com>

Hi,

    I am trying to audit registry Events for "Write DAC" using
Registry.pm. It does`nt contain KEY_WRITE_DAC. I tried adding
KEY_WRITE_DAC to the registry.pm it does`nt work. I don`t know what
modifications i have to make this work.

Is there any other module which covers this stuff. If so, could you
please point me to that.

Thanks.






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

Date: 24 Oct 2002 15:26:41 GMT
From: ctcgag@hotmail.com
Subject: Re: perl bug? "eq" less restrictive then  "=="?
Message-Id: <20021024112641.868$Kt@newsreader.com>

helgi@decode.is (Helgi Briem) wrote:
> On Thu, 24 Oct 2002 13:53:48 +0200, HEISERER DANIEL
> <daniel.heiserer@bmw.de> wrote:
> >As you can see there are some differences now (+ and -)
> >But by taking now the numerical comparison it works OK for me.
> >I just wonder why perl does NOT print an accurate $a if
> >$a=1+1e-15 because either the change does affect the mantisse
> >of the float value then it has to be there for comparison and
> >for writing it out OR the change does underrun the mantisse
> >then a print of $a as "1" is ok but then also the comparsion should
> >work. Is there a perl internal variable which controls the default
>
> This has nothing whatsoever to do with Perl and is solely
> a system architecture problem.

The precision and manner in which perl stringifies numerical values has
nothing whatsoever to do with Perl?  Come on.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
                    Usenet Newsgroup Service


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

Date: Thu, 24 Oct 2002 09:44:48 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: perl bug? "eq" less restrictive then  "=="?
Message-Id: <3DB81570.10A4F431@indra.com>

ctcgag@hotmail.com wrote:
> 
> helgi@decode.is (Helgi Briem) wrote:
> > On Thu, 24 Oct 2002 13:53:48 +0200, HEISERER DANIEL
> > <daniel.heiserer@bmw.de> wrote:
> > >As you can see there are some differences now (+ and -)
> > >But by taking now the numerical comparison it works OK for me.
> > >I just wonder why perl does NOT print an accurate $a if
> > >$a=1+1e-15 because either the change does affect the mantisse
> > >of the float value then it has to be there for comparison and
> > >for writing it out OR the change does underrun the mantisse
> > >then a print of $a as "1" is ok but then also the comparsion should
> > >work. Is there a perl internal variable which controls the default
> >
> > This has nothing whatsoever to do with Perl and is solely
> > a system architecture problem.
> 
> The precision and manner in which perl stringifies numerical values has
> nothing whatsoever to do with Perl?  Come on.
> 
> Xho
> 
> --
> -------------------- http://NewsReader.Com/ --------------------
>                     Usenet Newsgroup Service
Yes.  Refer to the C FAQ http://www.faqs.org/faqs/C-faq/toc/ and search
for "float".  Read section 14.

Giddy up.
-- 
Ron Reidy
Oracle DBA


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

Date: 24 Oct 2002 09:08:23 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Perl Calling C issues??
Message-Id: <1bff1830.0210240808.a12ad2b@posting.google.com>

This isn't really a perl question.  Please try comp.unix.programmer or
a forum specific to AIX.  You also might try your webservers websight,
(Apache?).  This issue is addressed quit often by Apache
documentation.

> this from his pc.  Our problem seems to be that since the webserver runs as
> nobody, the process it generates runs as nobody and doesn't have sufficient RW
> access to run the C program, read the data files (if the C program were to run)
> or to write to a file (given that the first two things happen).  We have tried
> various ways to get the script to run, including setuid and a program called
> cgiwrap, etc.  But AIX refuses to allow us to setuid to a file, even when we
> have the root level administrators try it.
> 
> We have done enough debugging to know that the C program works in it's own area,
> and have tested the perl script with our own test scripts to feel comfortable
> that it works when we run it where we have sufficient privileges.
> 
> Thanks
> Gary


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

Date: 24 Oct 2002 10:27:09 -0700
From: greggster7@hotmail.com (Gregg Palmer)
Subject: PL_Sv error
Message-Id: <3164b586.0210240927.5964bf45@posting.google.com>

Hello. I am trying to run an app written in perl and am getting the
following
error:[/usr/sbin]> collgui     

Can't load '/usr/opt/col/lib/site_perl/5.6.0/auto/Tk/Event/Event.so'
for module Tk::Event: dlopen:
/usr/opt/col/lib/site_perl/5.6.0/auto/Tk/Event/Event.so: symbol
"PL_Sv" unresolved at
/usr/local/lib/perl5/5.005/alpha-dec_osf-thread/DynaLoader.pm line
168.


I see references on the web, etc. to PL_Sv_undef, but not specifically
PL_Sv.

Any help/insights appreciated.

gregg


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

Date: 24 Oct 2002 15:16:35 GMT
From: ctcgag@hotmail.com
Subject: Re: regular expression
Message-Id: <20021024111635.463$WM@newsreader.com>

mary_wong1232002@yahoo.com (Mary Wong) wrote:
> Hello,
>
> Can anyone tell me what's wrong in this program?

This is not the program, is it?

> Everytime when i run it. I got nothing.

That problem is in the code you didn't show.


>
> while($_=<FH>)

Does the loop execute even once?  Are you opening FH?

> {
>      #print words begin and end with b's
>      print $_ if/^b.+b$/;

With at least one other letter in between them.


>      #print words contain 4 or more d
>      print $_ if/.*d{4,}.*/;

4 or more d's in a row.

>
>      #print words 3 or more letters long without vowels
>      print $_ if/[^aeiou]{3,}/;

Prints words with at least 3 non-vowels in a row.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
                    Usenet Newsgroup Service


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

Date: Thu, 24 Oct 2002 11:25:18 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: regular expression
Message-Id: <Pine.A41.3.96.1021024111504.27424A-100000@cortez.sss.rpi.edu>

[posted & mailed]

On Thu, 24 Oct 2002, David K. Wall wrote:

>Jeff 'japhy' Pinyan <pinyaj@rpi.edu> wrote on 24 Oct 2002:
>
>>   print if /d.*d.*d.*d/;
>
>    /(d[^d]*){4,}/
>
>better.  Correct me if I'm wrong, but I think it will do less backtracking.  
>/d.*d.*d.*d/ is easier to read, though.

The regex engine is smart enough to jump from 'd' to 'd' in my regex, so

  "ddddxxxxxxxxx" =~ /d.*d.*d.*d/

matches far faster than you might expect.

However, /d.*?d.*?d.*?d/ is faster, since it makes the smallest jump
possible, rather than the largest jump.  Here are three forms of your
regex:

  sub dwall1 { shift =~ /(d[^d]*){4,}/ }
  sub dwall2 { shift =~ /(d[^d]*){4}/ }
  sub dwall3 { shift =~ /(?:d[^d]*){4}/ }

and here are two hybrids (based on both of our regexes):

  sub hybrid1 { shift =~ /d[^d]*d[^d]*d[^d]*d/ }
  sub hybrid2 { shift =~ /d.*?d.*?d.*?d/ }

It turns out that hybrid1 is the fastest solution (given my data set),
just because it's the most explicit.  dwall3 is the fastest form of your
regex, because it a) doesn't use capturing parens, and b) explicitly asks
for 4 matches, no more.

Here's my benchmark program (a wee bit ugly):

  use Benchmark 'cmpthese';

  sub japhy { shift =~ /d.*d.*d.*d/ }
  sub dwall1 { shift =~ /(d[^d]*){4,}/ }
  sub dwall2 { shift =~ /(d[^d]*){4}/ }
  sub dwall3 { shift =~ /(?:d[^d]*){4}/ }
  sub hybrid1 { shift =~ /d[^d]*d[^d]*d[^d]*d/ }
  sub hybrid2 { shift =~ /d.*?d.*?d.*?d/ }

  my @w = qw( diddled addled adidased ddddxxxxxxxxxxxxxxxxxx );

  cmpthese(-5, {
    japhy => sub { japhy($_) for @w },
    dwall1 => sub { dwall1($_) for @w },
    dwall2 => sub { dwall2($_) for @w },
    dwall3 => sub { dwall3($_) for @w },
    hybrid1 => sub { hybrid1($_) for @w },
    hybrid2 => sub { hybrid2($_) for @w },
  });

-- 
Jeff "japhy" Pinyan      RPI Acacia Brother #734      2002 Acacia Senior Dean
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)



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

Date: 24 Oct 2002 10:35:25 -0700
From: erehwon@vanaheim.com (Rodney Engdahl)
Subject: Re: sendmail question
Message-Id: <b1e27a0c.0210240935.13cc8f38@posting.google.com>

"Anthony" <anthony.heuveline@wanadoo.fr> wrote in message news:<ap8hsi$2e4$1@news-reader11.wanadoo.fr>...
> Hi,
> 
>     I use the sendmail function in the context of a mailing list. As I don't
> want each person to know the e-mail adresses of the others, I call sendmail
> as many times as there are persons in my mailing list.

With this approach, you would likely have the problem whether you used
perl or not, so this is a bit off topic, but:

If you must use sendmail invocations instead of using majordomo or
mailman for mailing lists, ss there a reason you are avoiding BCC ?


> 
> .. .. .. if there is an error, is there a way to know which
> persons have received the e-mail and whic have not?


Any addresses that bounce should reveal the bouncee . . .


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

Date: Thu, 24 Oct 2002 15:40:08 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Trying to make a GUI.
Message-Id: <3db813ab.735940065@news.cis.dfn.de>

On Thu, 24 Oct 2002 14:49:35 +0100, "Richard S Beckett"
<spikey-wan@bigfoot.com> wrote:

>I need some really basic help, if you wouldn't mind.
>I'm using active state on win32.

I can't believe the following will work, or at least
not reliably, as the module is named Tk, not TK.

>use TK;
>use TK::DialogBox;

You'll need to change this to something like
my $main = MainWindow->new;

>my $main = "";

The rest seems OK.

>my $dialog = $main->DialogBox( -title => "Register this program.",
>       -buttons => [ "Register", "Cancel" ] );
>my $button = $dialog->Show();
>if ($button eq "Register"){print "Registered!\n"}
>elsif ($button eq "Cancel") {print "Cancelled!\n"}
>
>Can't call method "DialogBox" without a package or object reference at
>register.pl line 6.

-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: Thu, 24 Oct 2002 16:20:13 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Trying to make a GUI.
Message-Id: <15Vt9.4559$D63.174@news4.srv.hcvlny.cv.net>


"Richard S Beckett" <spikey-wan@bigfoot.com> wrote in message
news:ap8tqq$mb0$1@newshost.mot.com...
> Hello.
>
> I'm trying to add a GUI to my script, but am finding it very difficult.
>
> I have tried guido, and the gui loft, but I find the documentation isn't
> enough to get me started.
>
> So, I pulled out the perl cookbook. On page 540 there's a simple script
that
> should open a dialog box with 2 buttons, but for the life of me I can't
make
> it work.
>
> I need some really basic help, if you wouldn't mind.
>
> I'm using active state on win32.
>
> Here's the script, and errors...
>
> use strict;
> use warnings;
> use TK;
> use TK::DialogBox;
> my $main = "";
> my $dialog = $main->DialogBox( -title => "Register this program.",
>        -buttons => [ "Register", "Cancel" ] );
> my $button = $dialog->Show();
> if ($button eq "Register"){print "Registered!\n"}
> elsif ($button eq "Cancel") {print "Cancelled!\n"}
>
> Can't call method "DialogBox" without a package or object reference at
> register.pl line 6.
>
> Thanks.
>
> R.
>
>

I think that you are referring to the code at the top of Cookbook page 540.
This is not a complete script.  The complete script is shown in the
discussion section.  The Tk examples in the Cookbook are useful, but
difficult to use without an overview.  Have you read perldoc Tk::overview
and perldoc Tk::userguide

Bill





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

Date: Thu, 24 Oct 2002 11:46:20 -0500
From: zzhang1 <zzhang1@bcm.tmc.edu>
Subject: Why are empty tailing elements missing from the array returned by split?
Message-Id: <3DB82404@webmail.bcm.tmc.edu>

Sir,

I used the following code to test "split":

my @test = split(/,/, ",1,,2,3, 4, 5 , 6,,");
foreach (@test)
{
    print ">$_<\n";
}

The output is:
><
>1<
><
>2<
>3<
> 4<
> 5 <
> 6<


Apparently the two empty tailing elements are not in the returned array.
Is this an inconsistency or just a strange behavior of split?

Thank you.

Zhengdong Zhang



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

Date: Thu, 24 Oct 2002 12:30:16 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Why are empty tailing elements missing from the array returned by split?
Message-Id: <slrnargbh8.1mq.tadmc@magna.augustmail.com>

zzhang1 <zzhang1@bcm.tmc.edu> wrote:

> Apparently the two empty tailing elements are not in the returned array.
> Is this an inconsistency or just a strange behavior of split?


You should read the documentation for the functions that you use,
then you would know what behavior to expect.


   perldoc -f split

      ... By default, empty leading fields are preserved, 
      and empty trailing ones are deleted.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 24 Oct 2002 13:39:48 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: zzhang1 <zzhang1@bcm.tmc.edu>
Subject: Re: Why are empty tailing elements missing from the array returned by split?
Message-Id: <Pine.A41.3.96.1021024133923.19510A-100000@cortez.sss.rpi.edu>

[posted & mailed]

On Thu, 24 Oct 2002, zzhang1 wrote:

>Apparently the two empty tailing elements are not in the returned array.
>Is this an inconsistency or just a strange behavior of split?

This is the normal behavior of split().

See 'perldoc -f split'.

-- 
Jeff "japhy" Pinyan      RPI Acacia Brother #734      2002 Acacia Senior Dean
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)



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

Date: Thu, 24 Oct 2002 11:04:28 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Yet Another Perl Wrinkle!!!
Message-Id: <ap95n0$6q43@onews.collins.rockwell.com>

On 10/24/02 8:30 AM, Da Witch wrote:
>
> Yet another Perl "wrinkle" (I don't dare to call it "bug") cost me 1+
> hours' worth of pointless print-statement-based debugging.  This code
> illustrates the wrinkle:
> 
> [snip code]
> 
> OK, so if the sub is completely empty *and* if it is being called in
> an array context *and* it is being called as a class method, then it
> returns the class name, otherwise it returns nothing (undef?).

Close. An empty sub in list context returns @_. This behavior is
unspecified and (arguably) buggy.

For (a little) more info see this thread at google groups:
    <a73bcad1.0108120045.57f3e26d@posting.google.com>

> To make matters worse, in this behavior disappears in the debugger:

Not surprising. The debugger hooks probably change the optimization.

-mjc



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

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 4024
***************************************


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