[28128] in Perl-Users-Digest
Perl-Users Digest, Issue: 9492 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 18 03:05:52 2006
Date: Tue, 18 Jul 2006 00:05:05 -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 Tue, 18 Jul 2006 Volume: 10 Number: 9492
Today's topics:
Re: Can I compare array with array? <ced@blv-sam-01.ca.boeing.com>
Re: CGI: Running a forked background process <hal@thresholddigital.com>
Re: Cool Ebooks Site <sigzero@gmail.com>
Re: Extract alternate patterns <attn.steven.kuo@gmail.com>
Re: Extract alternate patterns <xicheng@gmail.com>
Re: Freeware IDE for perl? usenet@DavidFilmer.com
Re: how match/expose the value in an empty variable hav <glex_no-spam@qwest-spam-no.invalid>
matching for specific ascii decimal "non-printable char <jack_posemsky@yahoo.com>
Re: matching for specific ascii decimal "non-printable <someone@example.com>
new CPAN modules on Tue Jul 18 2006 (Randal Schwartz)
Re: simulate user activity <news41@8439.e4ward.com>
Re: What is a type error? [correction] <david.nospam.hopwood@blueyonder.co.uk>
What is the global hash %_ ? ozarfreo@yahoo.com
Re: What is the global hash %_ ? <someone@example.com>
Re: What is the global hash %_ ? ozarfreo@yahoo.com
Re: What is the global hash %_ ? <someone@example.com>
Re: What is the global hash %_ ? <penryu@saiyix.ath.cx>
Re: What is the global hash %_ ? <noreply@gunnar.cc>
Re: What is the global hash %_ ? ozarfreo@yahoo.com
Re: What is the global hash %_ ? <kevin@vaildc.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 17 Jul 2006 22:14:32 GMT
From: Charles DeRykus <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Can I compare array with array?
Message-Id: <J2KJ47.K2G@news.boeing.com>
A. Sinan Unur wrote:
> "Bart Van der Donck" <bart@nijlen.com> wrote in
> news:1153066153.522764.173280@i42g2000cwa.googlegroups.com:
>
>> A. Sinan Unur wrote:
>>
>>> "Bart Van der Donck" <bart@nijlen.com> wrote in
>>> news:1153061300.577609.326490@m79g2000cwm.googlegroups.com:
>>>
>>>> Davy wrote:
>>>>> Can I use if(@a==@b) directly?
>>>> [...]
>>>> But it's better practice to do
>>>>
>>>> if ( $#a == $#b ) { ... }
>>> Why?
>> I'ld say because with $#arrayname it is immediately clearer that we're
>> dealing with the number of elements,
>
> Boolean conditions provide scalar context. In that context, @a is the
> number of elements in @a, whereas $#a is one less than the number of
> elements in @a.
>
> One can actually compare arrays for equality in a single statement if
> the contents of the arrays are simple strings or numbers:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my @a = qw(one two three);
> my @b = qw(one two three);
> my @c = (1, 2, 3);
> my @d = (1.0, 2.0, 3.0);
>
> print 'Comparing @a and @b:', "@a" eq "@b" ? "equal\n" : "not equal\n";
> print 'Comparing @c and @d:', "@c" eq "@d" ? "equal\n" : "not equal\n";
> print 'Comparing @a and @d:', "@a" eq "@d" ? "equal\n" : "not equal\n";
>
Some oddballs will break that, eg,
my @c = ( " ", " ", );
my @d = ( " ", " " );
On the other hand, if you knew the array data contained printable char's
only, there's a better solution:
join("\0", @c) eq join("\0", @d) ? 'equal' : 'not equal'
--
Charles DeRykus
------------------------------
Date: Tue, 18 Jul 2006 00:36:42 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: CGI: Running a forked background process
Message-Id: <I5CdnTGNct2i-CHZnZ2dnUVZ_tqdnZ2d@comcast.com>
xhoster@gmail.com wrote:
> Hal Vaughan <hal@thresholddigital.com> wrote:
>> I have a web page (served up by Apache 2) where a user click a link to
>> download a file. The link calls my Perl CGI script which takes the
>> parameters and generates a file to download. It takes time to generate
>> the file, so my idea was to fork like this:
>>
> ...
>>
>> I've found, though, that the fork is not working. When I click on the
>> link, I get a LONG pause and eventually the countdown page appears, but
>> only after the forked program is done with it's work.
>
> The child program is holding onto the STDOUT and STDERR that it inherited
> from the parent. Apache knows that STDOUT is not yet closed, and
> therefore assumes the CGI isn't done yet and holds the connection to the
> browser open
> (or something like that.) The forked process needs to close or reopen
> STDOUT/STDERR in order to cut the web browser free.
>
> Xho
>
That did it. Thank you!
Hal
------------------------------
Date: 17 Jul 2006 16:49:52 -0700
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: Cool Ebooks Site
Message-Id: <1153180192.571041.219120@35g2000cwc.googlegroups.com>
A. Sinan Unur wrote:
> "Robert Hicks" <sigzero@gmail.com> wrote in
> news:1153172356.536460.42490@p79g2000cwp.googlegroups.com:
>
> >
> > bigskipster@gmail.com wrote:
> >> Robert Hicks wrote:
> >> > bigskipster@gmail.com wrote:
> ...
> >> > > Submit your comments because I need them!
> >> > >
> >> >
> >> > My comment would be that you need some ethics training.
>
> ...
>
> >> With that name you are of the ancestors of hillbilies. You do realize
> >> the hillbillies are not very smart?
> ...
>
> >> You do know what logic is don't you?
>
> I think we would all appreciate it if you did not engage the spamming
> troll. A more effective strategy is to complain to Google. He is posting
> from a Gmail account, and blogspot is owned by Google.
>
Okey dokey
------------------------------
Date: 17 Jul 2006 20:42:48 -0700
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Extract alternate patterns
Message-Id: <1153194168.835153.135780@p79g2000cwp.googlegroups.com>
harsha.ramanagoudra@gmail.com wrote:
> Hi all,
> I am trying to extract alternate patterns in strings. The difficulty
> is because of optional patterns.
>
> Below is the code,$transaction is the search string.
>
> if($transaction =~ /(addReq|modReq|subtractReq)+?.*?(addReq)?/){
> print "$1..$2\n";
> }
>
> The above code is succeeding to match the first pattern but always
> fails to match the optional second addReq. The output I get is
>
> addReq..
>
> My intention is that this search extracts patterns like those below. In
> some cases $2 may be undef
>
It's not absolutely clear what you expect
the output to be. In any case, this
may be one of those instances where it's
easlier to use pattern matches against
the reversed string:
#!/usr/bin/perl
use strict;
use warnings;
my $alternation =
join '|' => map { scalar reverse $_ }
(qw/foo bar baz/);
my $qr1 = qr/$alternation/;
my $last = reverse "foo";
my $qr2 = qr/$last/;
while (<DATA>)
{
chomp;
my $target_string = reverse $_;
print $_, "\n";
show_match("\tA:")
if ($target_string =~ /($qr2)?(?=.*($qr1))/);
show_match("\tB:")
if ($target_string =~ /(?:($qr2)|(?!.*$qr2.))(?=.*($qr1))/)
}
sub show_match
{
my $tag = shift;
my $first = scalar reverse $2;
my $last = $1 ? scalar reverse $1 : '';
print "$tag $first and $last\n";
};
__DATA__
baz foo baz foo baz
foo bar foo
foo
foo foo
foo bar baz baz
baz foo
--
Hope this helps,
Steven
------------------------------
Date: 17 Jul 2006 21:50:23 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: Extract alternate patterns
Message-Id: <1153198223.167538.78270@s13g2000cwa.googlegroups.com>
harsha.ramanagoudra@gmail.com wrote:
> Hi all,
> I am trying to extract alternate patterns in strings. The difficulty
> is because of optional patterns.
>
> Below is the code,$transaction is the search string.
>
> if($transaction =~ /(addReq|modReq|subtractReq)+?.*?(addReq)?/){
> print "$1..$2\n";
> }
>
> The above code is succeeding to match the first pattern but always
> fails to match the optional second addReq. The output I get is
>
> addReq..
>
> My intention is that this search extracts patterns like those below. In
> some cases $2 may be undef
>
> addReq
> addReq..addReq
> modReq..addReq
> subtractReq
>
Your problem lies in those lazy quantifiers, if there is not any
constriant behind those (...)? constructs, they match nothing by
default. so a simply fix to your problem is changing the last (...)?
construct to an alternation ( .. | .. ) like:
if ($transaction =~ /(addReq|modReq|subtractReq).*?(addReq|$)/)
Xicheng
------------------------------
Date: 17 Jul 2006 19:27:24 -0700
From: usenet@DavidFilmer.com
Subject: Re: Freeware IDE for perl?
Message-Id: <1153189644.148384.16260@m73g2000cwd.googlegroups.com>
jtpryan wrote:
> Can anybody recommend good ones?
Have you tried asking Perl for recommendations?
perldoc -q ide
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Mon, 17 Jul 2006 17:21:16 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: how match/expose the value in an empty variable having length of 1
Message-Id: <v2Uug.13$IM5.320@news.uswest.net>
Jack wrote:
> Hi folks,
>
> Ok I am stumped... I am reading a fileline in as follows:
>
> 12535957@140@2006-07-08 09:34:45.000@@@2005-11-24@
>
> and splitting on the "@"...
> open(SOURCE1,$filename1)
> @columnarray = split(/\@/, $_);
Post real code as an example. If your code is actually the above, then
it has a lot of problems.
>
> Whats really wierd is $columnarray[4] has a length of 1, when clearly
> above its NULL !!
How do you know its length is 1?
> I want to be able to recognize this as null, but you cant even match
> regex it... I tried
>
> if ($columnarray[4] =~ m/.*?[[:print:]]/) { print " NON PRINTABLE
> "."\n"; }
> $columnarray[4] =~ s/^\s+//;
> $columnarray[4] =~ s/\s+$//;
> $length = length @columnarray[4]."\n";
Adding these to your code would have caught the error..
use strict;
use warnings;
my $length = length $columnarray[4]
> and a number of other things that dont work.. how do I identify "WHAT"
> is making up the length =1 ?
>
> Also, what is the detection match test for NULL ?
Maybe this will help you:
perldoc -f defined
A short script as an example:
#!/usr/bin/perl
use strict;
use warnings;
my $str='12535957@140@2006-07-08 09:34:45.000@@@2005-11-24@';
my @columnarray = split(/\@/, $str);
print "length=", length( $columnarray[4] ), "\n";
print "columnarray[4] is an undefined value" unless defined $columnarray[4];
------------------------------
Date: 17 Jul 2006 20:30:00 -0700
From: "Jack" <jack_posemsky@yahoo.com>
Subject: matching for specific ascii decimal "non-printable character"
Message-Id: <1153193400.346117.78000@p79g2000cwp.googlegroups.com>
Hi
I have "decimal 28 nonprintables" in my file as delimiters, this I
know.
How do I match to it ? I tried the following and they dont seem to be
detecting - any ideas ?
if ($_ =~ m/\028/) { print " a "; }
if ($_ =~ m/028/) { print " 0 "; }
if ($_ =~ m/28/) { print " 1 "; }
if ($_ =~ m/-d '\028'/) { print " 2 ";}
Also, does someone know how to detect newlines (carriage returns) as
the first character in a string (in this case a variable where I read
in a file record... I tried the below and it too is not detecting !
if ($newline =~ m/^\n/) { print " newline " ; }
Many Thanks,
Jack
------------------------------
Date: Tue, 18 Jul 2006 05:58:54 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: matching for specific ascii decimal "non-printable character"
Message-Id: <yM_ug.51650$B91.18844@edtnps82>
Jack wrote:
>
> I have "decimal 28 nonprintables" in my file as delimiters, this I
> know.
> How do I match to it ? I tried the following and they dont seem to be
> detecting - any ideas ?
>
> if ($_ =~ m/\028/) { print " a "; }
> if ($_ =~ m/028/) { print " 0 "; }
> if ($_ =~ m/28/) { print " 1 "; }
> if ($_ =~ m/-d '\028'/) { print " 2 ";}
If you want to use an octal escape sequence then you have to convert the
decimal number to octal:
$ perl -e'printf "%o\n", 28'
34
And then you can use that:
if ( /\034/ ) { print ' a ' }
Or you could convert it to hexadecimal:
$ perl -e'printf "%X\n", 28'
1C
And use that:
if ( /\x1C/ ) { print ' a ' }
Or since it is an ASCII control character you could use that:
if ( /\c\\\(?:)/ ) { print ' a ' }
(Ugly I know but the backslashes screw things up.)
> Also, does someone know how to detect newlines (carriage returns) as
> the first character in a string (in this case a variable where I read
> in a file record... I tried the below and it too is not detecting !
>
> if ($newline =~ m/^\n/) { print " newline " ; }
Newlines and carriage returns are (usually) two different things. You may
need to use:
if ( $newline =~ m/^\r/ ) { print " newline " }
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 18 Jul 2006 04:42:06 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jul 18 2006
Message-Id: <J2L126.1xoz@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Acme-MetaSyntactic-0.83
http://search.cpan.org/~book/Acme-MetaSyntactic-0.83/
Themed metasyntactic variables names
----
Acme-MorseComments-1.00
http://search.cpan.org/~jwheeler/Acme-MorseComments-1.00/
Completely useless module that replaces all of your software's comments with morse code.
----
Algorithm-SVMLight-0.05
http://search.cpan.org/~kwilliams/Algorithm-SVMLight-0.05/
Perl interface to SVMLight Machine-Learning Package
----
BerkeleyDB-SecIndices-Accessor-0.02
http://search.cpan.org/~dongxu/BerkeleyDB-SecIndices-Accessor-0.02/
Simply drive your BerkeleyDB database with secondary indices
----
Carp-Always-0.06
http://search.cpan.org/~ferreira/Carp-Always-0.06/
Warns and dies noisily with stack backtraces
----
DBIx-Class-DateTime-Epoch-0.02
http://search.cpan.org/~adapay/DBIx-Class-DateTime-Epoch-0.02/
Automatic inflation/deflation of epoch-based DateTime objects for DBIx::Class
----
Data-Thunk-0.01
http://search.cpan.org/~audreyt/Data-Thunk-0.01/
Calculate values on demand
----
Directory-Scratch-0.03
http://search.cpan.org/~jrockway/Directory-Scratch-0.03/
Easy-to-use self-cleaning scratch space.
----
Expect-1.19
http://search.cpan.org/~rgiersig/Expect-1.19/
----
ExtUtils-ModuleMaker-TT-0.93
http://search.cpan.org/~dagolden/ExtUtils-ModuleMaker-TT-0.93/
Makes skeleton modules with Template Toolkit templates
----
Finance-Bank-Postbank_de-0.24
http://search.cpan.org/~corion/Finance-Bank-Postbank_de-0.24/
Check your Postbank.de bank account from Perl
----
Graphics-Libplot-2.2.1
http://search.cpan.org/~jlapeyre/Graphics-Libplot-2.2.1/
Perl extension for libplot plotting library
----
IO-Socket-SSL-0.99
http://search.cpan.org/~sullr/IO-Socket-SSL-0.99/
Nearly transparent SSL encapsulation for IO::Socket::INET.
----
IO-Socket-TIPC-1.06
http://search.cpan.org/~infinoid/IO-Socket-TIPC-1.06/
TIPC sockets for Perl
----
IO-Tty-1.06
http://search.cpan.org/~rgiersig/IO-Tty-1.06/
Low-level allocate a pseudo-Tty, import constants.
----
IPC-Open3-Simple-0.01
http://search.cpan.org/~erwan/IPC-Open3-Simple-0.01/
A simple alternative to IPC::Open3
----
Lemonldap-Portal-Standard-3.0.0
http://search.cpan.org/~egerman/Lemonldap-Portal-Standard-3.0.0/
Perl extension for the Lemonldap SSO system
----
Luka-1.07
http://search.cpan.org/~tpg/Luka-1.07/
Exception handling and reporting framework
----
MMS-Mail-Parser-0.14
http://search.cpan.org/~robl/MMS-Mail-Parser-0.14/
A class for parsing MMS (or picture) messages via email.
----
Maypole-2.11_pre4
http://search.cpan.org/~teejay/Maypole-2.11_pre4/
MVC web application framework
----
Module-CPANTS-Analyse-0.61
http://search.cpan.org/~domm/Module-CPANTS-Analyse-0.61/
Generate Kwalitee ratings for a distribution
----
Module-Compile-0.18
http://search.cpan.org/~ingy/Module-Compile-0.18/
Perl Module Compilation
----
Net-IRC3-0.3
http://search.cpan.org/~elmex/Net-IRC3-0.3/
An event system independend IRC protocol module
----
Object-Declare-0.01
http://search.cpan.org/~audreyt/Object-Declare-0.01/
Declare object constructor
----
Object-Declare-0.02
http://search.cpan.org/~audreyt/Object-Declare-0.02/
Declarative object constructor
----
Object-Declare-0.03
http://search.cpan.org/~audreyt/Object-Declare-0.03/
Declarative object constructor
----
Object-Declare-0.04
http://search.cpan.org/~audreyt/Object-Declare-0.04/
Declarative object constructor
----
Object-Declare-0.05
http://search.cpan.org/~audreyt/Object-Declare-0.05/
Declarative object constructor
----
Object-Declare-0.06
http://search.cpan.org/~audreyt/Object-Declare-0.06/
Declarative object constructor
----
P4-3.5313
http://search.cpan.org/~smee/P4-3.5313/
OO interface to the Perforce SCM System.
----
PDL-Fit-Levmar-0.0081
http://search.cpan.org/~jlapeyre/PDL-Fit-Levmar-0.0081/
Levenberg-Marquardt fit/optimization routines
----
Perl-Critic-0.18
http://search.cpan.org/~thaljef/Perl-Critic-0.18/
Critique Perl source code for best-practices
----
Perl-Critic-Bangs-0.22
http://search.cpan.org/~petdance/Perl-Critic-Bangs-0.22/
A collection of handy Perl::Critic policies
----
Scalar-Defer-0.02
http://search.cpan.org/~audreyt/Scalar-Defer-0.02/
Calculate values on demand
----
Scalar-Defer-0.03
http://search.cpan.org/~audreyt/Scalar-Defer-0.03/
Calculate values on demand
----
Test-HasVersion-0.011
http://search.cpan.org/~ferreira/Test-HasVersion-0.011/
Check Perl modules have version numbers
----
Text-Index-0.01
http://search.cpan.org/~smueller/Text-Index-0.01/
Create indices of a set of pages using a set of keywords
----
Text-vCard-1.98
http://search.cpan.org/~llap/Text-vCard-1.98/
a package to edit and create a single vCard (RFC 2426)
----
Tree-Binary-Dictionary-1.01
http://search.cpan.org/~teejay/Tree-Binary-Dictionary-1.01/
A dictionary API to a binary tree
----
XML-Feed-0.10
http://search.cpan.org/~btrott/XML-Feed-0.10/
Syndication feed parser and auto-discovery
----
v6-alpha-0.010
http://search.cpan.org/~fglock/v6-alpha-0.010/
----
version-0.65
http://search.cpan.org/~jpeacock/version-0.65/
Perl extension for Version Objects
----
version-0.651
http://search.cpan.org/~jpeacock/version-0.651/
Perl extension for Version Objects
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 18 Jul 2006 00:47:26 +0200
From: Michael Goerz <news41@8439.e4ward.com>
Subject: Re: simulate user activity
Message-Id: <4i2ibuF1sm44U1@uni-berlin.de>
Lars Madsen wrote:
> I have a new user/server Linux setup that I would like to test using our
> diskless terminals (LTSP).
>
> I was thinks about running several test user accounts (to also see how
> it behaves with a lot of X activity), and then create a program to be
> run by each test user that simulates some normal user behavior.
> Something like opening a program from some list, and closing it again
> after a while.
>
> But it should of course not run linear, some randomized stuff is of
> course needed.
>
> Does anyone have any experience in this area? Does there exist modules
> that would help?
>
> Any advise on how to proceed would be appreciated.
>
> /daleif
use random number generator:
http://faq.perl.org/perlfaq4.html#How_do_I_get_a_rando
I would put a list of programs in the script, and use the random number
generator to
- start a program at a random time
- choose randomly which program to start
- choose randomly how long the program should be running
Michael
------------------------------
Date: Tue, 18 Jul 2006 02:32:38 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is a type error? [correction]
Message-Id: <aLXug.11420$5B3.4643@fe2.news.blueyonder.co.uk>
Darren New wrote:
> David Hopwood wrote:
>
>> public class LoopInitTest {
>> public static String getString() { return "foo"; }
>>
>> public static void main(String[] args) {
>> String line = getString();
>> boolean is_last = false;
>>
>> while (!is_last) {
>> if (line.charAt(0) == 'q') {
>> is_last = true;
>> }
>>
>> // insert line into inputs (not important for analysis)
>>
>> if (!is_last) {
>> line = getString();
>> }
>> }
>> }
>> }
>>
>> which compiles without error, because is_last is definitely initialized.
>
> At what point do you think is_last or line would seem to not be
> initialized? They're both set at the start of the function, and (given
> that it's Java) nothing can unset them.
>
> At the start of the while loop, it's initialized. At the end of the
> while loop, it's initialized. So the merge point of the while loop has
> it marked as initialized.
Apparently, Hermes (at least the version of it described in that paper)
essentially forgets that is_last has been initialized at the top of the
loop, and so when it does the merge, it is merging 'not necessarily initialized'
with 'initialized'.
This sounds like a pretty easy thing to fix to me (and maybe it was fixed
later, since there are other papers on Hermes' typestate checking that I
haven't read yet).
--
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
------------------------------
Date: 17 Jul 2006 15:31:45 -0700
From: ozarfreo@yahoo.com
Subject: What is the global hash %_ ?
Message-Id: <1153175505.921027.224150@s13g2000cwa.googlegroups.com>
I've seen that %_ is treated as a special variable in Perl, as $_ and
@_ are: no warning is issued when using it without a package name, no
'my' is allowed on that var; the problem is that I could not find it
among Perl's documentation.
I'd like to use it in a program but am not sure whether I might be
interfering with some other intended use for %_ . Can someone point out
what is this variable exactly, and whether it is safe to use it?
------------------------------
Date: Mon, 17 Jul 2006 23:04:17 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: What is the global hash %_ ?
Message-Id: <RHUug.110583$I61.73488@clgrps13>
ozarfreo@yahoo.com wrote:
> I've seen that %_ is treated as a special variable in Perl, as $_ and
> @_ are: no warning is issued when using it without a package name, no
> 'my' is allowed on that var; the problem is that I could not find it
> among Perl's documentation.
>
> I'd like to use it in a program but am not sure whether I might be
> interfering with some other intended use for %_ . Can someone point out
> what is this variable exactly, and whether it is safe to use it?
If it is not listed in perlvar then perl doesn't care what you do with it.
John
--
use Perl;
program
fulfillment
------------------------------
Date: 17 Jul 2006 16:10:17 -0700
From: ozarfreo@yahoo.com
Subject: Re: What is the global hash %_ ?
Message-Id: <1153177817.194887.93320@s13g2000cwa.googlegroups.com>
> If it is not listed in perlvar then perl doesn't care what you do with it.
Then is there any reason for it to be treated specially?
------------------------------
Date: Mon, 17 Jul 2006 23:29:33 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: What is the global hash %_ ?
Message-Id: <x3Vug.141733$771.1873@edtnps89>
ozarfreo@yahoo.com wrote:
>>If it is not listed in perlvar then perl doesn't care what you do with it.
> Then is there any reason for it to be treated specially?
All Sigil-Punctuation variables are special, whether perl uses them or not.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 17 Jul 2006 23:51:45 GMT
From: Tim Hammerquist <penryu@saiyix.ath.cx>
Subject: Re: What is the global hash %_ ?
Message-Id: <slrnebo8ki.t2.penryu@ruri.saiyix>
John W. Krahn <someone@example.com> wrote:
> ozarfreo@yahoo.com wrote:
>>>If it is not listed in perlvar then perl doesn't care what you do with it.
>> Then is there any reason for it to be treated specially?
>
> All Sigil-Punctuation variables are special, whether perl uses them or not.
Each and every variable is a unique and special snowflake.
Tim Hammerquist
------------------------------
Date: Tue, 18 Jul 2006 01:56:17 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: What is the global hash %_ ?
Message-Id: <4i2macF1tpc3U1@individual.net>
ozarfreo@yahoo.com wrote:
> I've seen that %_ is treated as a special variable in Perl, as $_ and
> @_ are: no warning is issued when using it without a package name, no
> 'my' is allowed on that var; the problem is that I could not find it
> among Perl's documentation.
>
> I'd like to use it in a program but am not sure whether I might be
> interfering with some other intended use for %_ .
Considering similar variables that are used by Perl and documented in
perlvar, it does not seem unlikely that it will be predefined in future
Perl versions. Hence, I for one would not use it. To be safe.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 17 Jul 2006 16:55:28 -0700
From: ozarfreo@yahoo.com
Subject: Re: What is the global hash %_ ?
Message-Id: <1153180528.922988.111840@h48g2000cwc.googlegroups.com>
John W. Krahn wrote:
> All Sigil-Punctuation variables are special, whether perl uses them or not.
Is this behavior documented somewhere?
------------------------------
Date: Tue, 18 Jul 2006 00:25:33 GMT
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: What is the global hash %_ ?
Message-Id: <kevin-D1B2C2.20253217072006@news.verizon.net>
In article <RHUug.110583$I61.73488@clgrps13>,
"John W. Krahn" <someone@example.com> wrote:
> ozarfreo@yahoo.com wrote:
> > I've seen that %_ is treated as a special variable in Perl, as $_ and
> > @_ are: no warning is issued when using it without a package name, no
> > 'my' is allowed on that var; the problem is that I could not find it
> > among Perl's documentation.
> >
> > I'd like to use it in a program but am not sure whether I might be
> > interfering with some other intended use for %_ . Can someone point out
> > what is this variable exactly, and whether it is safe to use it?
>
> If it is not listed in perlvar then perl doesn't care what you do with it.
It probably only comes along because it's in the same glob as $_ and @_,
oh and _ the special filehandle for stat.
Personally, if someone can come up with a syntax for the call, it'd make
a great place to put named function parameters.
--
boss, sometimes i think | kevin michael vail
that our friend mehitabel | kevin@vaildc.net
is a trifle too gay |
-- archy | wotthehell wotthehell
------------------------------
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 9492
***************************************