[30058] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1301 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 23 14:09:44 2008

Date: Sat, 23 Feb 2008 11:09:05 -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           Sat, 23 Feb 2008     Volume: 11 Number: 1301

Today's topics:
    Re: BEGIN not safe after errors--compilation aborted <darrenbird@dipinternational.co.uk>
    Re: Building DBD::Pg on Windows? <bill@teraXNOSPAMXquest.com>
        checking for duplicates in a string <john1949@yahoo.com>
    Re: checking for duplicates in a string <noreply@gunnar.cc>
    Re: checking for duplicates in a string <noreply@gunnar.cc>
        Form submit with mechanize 0.72 <cashback103@dodgeit.com>
    Re: Long line in perl script <stoupa@practisoft.cz>
        new CPAN modules on Sat Feb 23 2008 (Randal Schwartz)
    Re: Speeding my script (Jamie)
    Re: Spreadsheet::ParseExcel - How to get certain Cells <not@home.net>
        Storing references in a hash - why does Perl complain h <ro.naldfi.scher@gmail.com>
    Re: Storing references in a hash - why does Perl compla ( )@( )
    Re: Storing references in a hash - why does Perl compla <sinan.unur@gmail.com>
    Re: Storing references in a hash - why does Perl compla <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 23 Feb 2008 10:17:26 -0800 (PST)
From: daz9643 <darrenbird@dipinternational.co.uk>
Subject: Re: BEGIN not safe after errors--compilation aborted
Message-Id: <02d54e99-04f7-4994-8b52-be88a02abb7d@n75g2000hsh.googlegroups.com>

ok ,the actual google code does not include the lines
use CGI::Carp qw(fatalsToBrowser);
ul class="simpleblue"

these to lines were just added to help with debugging. Without these 2
lines i just get the error 500.
You're right about line 9, there were a few blank lines in the code
which i've deleted as they weren't necessary. If i remove the
offending line of code or rem it out the error just points to the next
line of code and so on.


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

Date: Sat, 23 Feb 2008 10:17:10 -0600
From: "Bill Cohagan" <bill@teraXNOSPAMXquest.com>
Subject: Re: Building DBD::Pg on Windows?
Message-Id: <47c0470a$0$17353$4c368faf@roadrunner.com>

Christoph
  Thanks for this pointer.  Unfortunately this requires PPM which I 
attempted to obtain. I couldn't install PPM because the install is 
apparently not intended for cygwin perl environment. I did manage to hack 
the install script a get it installed, but then ran into (apparently) cygwin 
related problems in trying to run it. Ultimately I just downloaded the tar 
file the the DBD ppd file pointed to, but decompressing just gives me a top 
level directory with a lot of empty subfolders and a few dlls, etc. I have 
no idea how to incorporate this into the perl environment so that it is 
useable.

  If there is a procedure to follow to manually install such a folder 
structure I'd appreciate a pointer to it.

Regards,
 Bill

"Ch Lamprecht" <ch.l.ngre@online.de> wrote in message 
news:f40v30$8cu$1@online.de...
> Bill Cohagan wrote:
>
>> I'd really like to use DBD on Windows XP as without it Perl isn't of much 
>> use to our project; however I'm stumped out fo the gate trying to build 
>> this code.  Any help (or pointers to help) would be greatly appreciated.
>>
>
> Hi, there are binaries available at:
>
> http://pgfoundry.org/frs/?group_id=1000199&release_id=589
>
> Christoph
>
> -- 
> use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
> TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker);
> Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
> $c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop 




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

Date: Sat, 23 Feb 2008 11:18:04 -0000
From: "John" <john1949@yahoo.com>
Subject: checking for duplicates in a string
Message-Id: <HIudnR7aEbl3nV3anZ2dnUVZ8h2dnZ2d@eclipse.net.uk>

Hi

Consider a string $packed consisting of "AAXYGHDRJKYYXYZZGH"
This represent items of two chars eg AA XY GH etc.
I need to remove duplicates.
I can do it by 'unpacking' and repacking using two loops such as

for (my $j=0; $j<$total; $j=$j+2) {
    my $part1=substr($packed,$j,2);
etc  etc.

But is there a better, dare I say, elegant, way?

Regards
John




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

Date: Sat, 23 Feb 2008 12:36:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: checking for duplicates in a string
Message-Id: <62aeuiF22f1j7U1@mid.individual.net>

John wrote:
> Consider a string $packed consisting of "AAXYGHDRJKYYXYZZGH"
> This represent items of two chars eg AA XY GH etc.
> I need to remove duplicates.
> I can do it by 'unpacking' and repacking using two loops such as
> 
> for (my $j=0; $j<$total; $j=$j+2) {
>     my $part1=substr($packed,$j,2);
> etc  etc.
> 
> But is there a better, dare I say, elegant, way?

     my $packed = 'AAXYGHDRJKYYXYZZGH';
     my %seen;
     print join(' ', map $seen{$_}++ ? () : $_, $packed =~ /../g), "\n";

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Sat, 23 Feb 2008 13:39:10 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: checking for duplicates in a string
Message-Id: <62aijdF22kh2pU1@mid.individual.net>

Gunnar Hjalmarsson wrote:
> 
>     my $packed = 'AAXYGHDRJKYYXYZZGH';
>     my %seen;
>     print join(' ', map $seen{$_}++ ? () : $_, $packed =~ /../g), "\n";

The grep() function is more to the point:

     print join(' ', grep !$seen{$_}++, $packed =~ /../g), "\n";

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Sat, 23 Feb 2008 05:38:43 -0800 (PST)
From: Cashbackre <cashback103@dodgeit.com>
Subject: Form submit with mechanize 0.72
Message-Id: <41c0c547-44ca-4899-98db-5449e135ebe8@72g2000hsu.googlegroups.com>

I am currently using mechanize 0.72 on active perl 5.8.6 for some
strange reason I cannot upgrade to the current version
of 1.34 so this is not an option, the problem is I am trying to submit
my login details on a page with two forms
with the same name but different values, I am trying to submit to the
second form with relevant form html:
<input type=submit name=submit value="  S  E  N  D  ">,
I understand mechanize 1.34 has a click_button function, whereby I can
click by value, however 0.72 does not have the click_button function,
I can fill in my username and password, and check that they have been
filled in correctly but every submission of the form either via
$mech->click("submit");
or $mech->submit();
or $mech->submit("submit");
ends up submitting the very first form


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

Date: Sat, 23 Feb 2008 15:16:49 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Long line in perl script
Message-Id: <fpp9tp$god$1@ns.felk.cvut.cz>

John W. Krahn wrote:
> Petr Vileta wrote:
>>
>> Subra wrote:
>>>
>>> Is there any special character like in C (\) which I should put at
>>> the end of the broken line ????
>>>
>> You can wrap line at any space in your long line. Example:
>>
>> if ($settings->{$service_name}->{'pin_home_dir'}    ||
>> $settings->{$service_type}->{'pin_home_dir'}) {
>
> It doesn't even have to be at a space:
>
> $ perl -MData::Dumper -le'$w->{x}->{y}->{z} = "hello"; print Dumper
> $w' $VAR1 = {
>           'x' => {
>                    'y' => {
>                             'z' => 'hello'
>                           }
>                  }
>         };
>
> $ perl -MData::Dumper -le'
> $w
> ->
> {x}
> ->
> {y}
> ->
> {z}
> =
> "hello";
> print Dumper $w'
> $VAR1 = {
>           'x' => {
>                    'y' => {
>                             'z' => 'hello'
>                           }
>                  }
>         };
>
Yes, of course, but wrapping line at space (or tab) is better readable for 
human and for perl novice too ;-)
-- 
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>



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

Date: Sat, 23 Feb 2008 05:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Feb 23 2008
Message-Id: <JwoFuH.DwK@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.

CGI-Application-Plugin-TmplInnerOuter-1.11
http://search.cpan.org/~leocharre/CGI-Application-Plugin-TmplInnerOuter-1.11/
----
CGI-Application-Plugin-View-HTML-Template-0.02
http://search.cpan.org/~mfuller/CGI-Application-Plugin-View-HTML-Template-0.02/
Automatically render HTML::Templates in CGI::Application 
----
Catalyst-View-JSON-0.23
http://search.cpan.org/~miyagawa/Catalyst-View-JSON-0.23/
JSON view for your data 
----
Coat-Persistent-0.0_0.3
http://search.cpan.org/~sukria/Coat-Persistent-0.0_0.3/
Simple Object-Relational mapping for Coat objects 
----
Data-Pageset-1.05
http://search.cpan.org/~llap/Data-Pageset-1.05/
Page numbering and page sets 
----
Egg-Plugin-SessionKit-3.02
http://search.cpan.org/~lushe/Egg-Plugin-SessionKit-3.02/
Package kit to use session. 
----
Email-Fingerprint-0.24
http://search.cpan.org/~budney/Email-Fingerprint-0.24/
Calculate a digest for recognizing duplicate emails 
----
File-Find-Object-0.0.9
http://search.cpan.org/~shlomif/File-Find-Object-0.0.9/
An object oriented File::Find replacement 
----
File-PathInfo-1.20
http://search.cpan.org/~leocharre/File-PathInfo-1.20/
access to path variables, stat data, misc info about a file 
----
Finance-Bank-Cahoot-0.03
http://search.cpan.org/~masaccio/Finance-Bank-Cahoot-0.03/
Check your Cahoot bank accounts from Perl 
----
Games-Hack-Live-0.5
http://search.cpan.org/~pmarek/Games-Hack-Live-0.5/
Perl script to ease playing games 
----
Getopt-Euclid-v0.2.0
http://search.cpan.org/~dconway/Getopt-Euclid-v0.2.0/
Executable Uniform Command-Line Interface Descriptions 
----
HTML-BBCode-2.03
http://search.cpan.org/~blom/HTML-BBCode-2.03/
Perl extension for converting BBcode to HTML. 
----
HTML-FillInForm-Lite-0.07
http://search.cpan.org/~gfuji/HTML-FillInForm-Lite-0.07/
Fills in HTML forms with data 
----
HTML-WikiConverter-DokuWikiFCK-0.17
http://search.cpan.org/~turnermm/HTML-WikiConverter-DokuWikiFCK-0.17/
A WikiConverter Dialect supporting the FCKeditor in DokuWiki 
----
IO-Socket-INET6-2.54
http://search.cpan.org/~shlomif/IO-Socket-INET6-2.54/
Object interface for AF_INET|AF_INET6 domain sockets 
----
IO-Socket-SSL-1.13_2
http://search.cpan.org/~sullr/IO-Socket-SSL-1.13_2/
Nearly transparent SSL encapsulation for IO::Socket::INET. 
----
LEOCHARRE-CLI-1.12
http://search.cpan.org/~leocharre/LEOCHARRE-CLI-1.12/
useful subs for coding cli scripts 
----
Music-Tag-LyricsFetcher-0.02
http://search.cpan.org/~ealleniii/Music-Tag-LyricsFetcher-0.02/
Music::Tag plugin to use Lyrics::Fetcher 
----
Music-Tag-M4A-0.3
http://search.cpan.org/~ealleniii/Music-Tag-M4A-0.3/
Plugin module for Music::Tag to get information from Apple QuickTime headers. 
----
Music-Tag-MusicBrainz-0.29
http://search.cpan.org/~ealleniii/Music-Tag-MusicBrainz-0.29/
Plugin module for Music::Tag to get information from MusicBrainz database. 
----
Music-Tag-OGG-0.3
http://search.cpan.org/~ealleniii/Music-Tag-OGG-0.3/
Plugin module for Music::Tag to get information from ogg-vorbis headers. 
----
Music-Tag-OGG-0.31
http://search.cpan.org/~ealleniii/Music-Tag-OGG-0.31/
Plugin module for Music::Tag to get information from ogg-vorbis headers. 
----
Music-Tag-OGG-0.32
http://search.cpan.org/~ealleniii/Music-Tag-OGG-0.32/
Plugin module for Music::Tag to get information from ogg-vorbis headers. 
----
Net-SIP-0.43
http://search.cpan.org/~sullr/Net-SIP-0.43/
Framework SIP (Voice Over IP, RFC3261) 
----
ObjectDBI-0.11
http://search.cpan.org/~kjh/ObjectDBI-0.11/
Perl Object Persistence in an RDBMS using DBI 
----
POE-Component-Win32-Service-1.16
http://search.cpan.org/~bingos/POE-Component-Win32-Service-1.16/
A POE component that provides non-blocking access to Win32::Service. 
----
POEIKC-0.00_07
http://search.cpan.org/~suzuki/POEIKC-0.00_07/
POE IKC daemon and client 
----
Perl-Repository-APC-2.000_294
http://search.cpan.org/~andk/Perl-Repository-APC-2.000_294/
Class modelling "All Perl Changes" repository 
----
RPSL-Parser-0.01
http://search.cpan.org/~lmc/RPSL-Parser-0.01/
Router Policy Specification Language (RFC2622) Parser 
----
Smart-Comments-v1.0.3
http://search.cpan.org/~dconway/Smart-Comments-v1.0.3/
Comments that do more than just sit there 
----
Template-Direct-1.12
http://search.cpan.org/~doctormo/Template-Direct-1.12/
Creates a document page based on template/datasets 
----
Template-Direct-1.13
http://search.cpan.org/~doctormo/Template-Direct-1.13/
Creates a document page based on template/datasets 
----
Thread-Cancel-1.07
http://search.cpan.org/~jdhedden/Thread-Cancel-1.07/
Cancel (i.e., kill) threads 
----
Thread-Queue-2.06
http://search.cpan.org/~jdhedden/Thread-Queue-2.06/
Thread-safe queues 
----
Thread-Semaphore-2.07
http://search.cpan.org/~jdhedden/Thread-Semaphore-2.07/
Thread-safe semaphores 
----
Thread-Suspend-1.12
http://search.cpan.org/~jdhedden/Thread-Suspend-1.12/
Suspend and resume operations for threads 
----
TiVo-Calypso-1.3.4
http://search.cpan.org/~sschneid/TiVo-Calypso-1.3.4/
a Perl interface to the TiVo Calypso protocol 
----
WWW-ImagebinCa-Create-0.01
http://search.cpan.org/~zoffix/WWW-ImagebinCa-Create-0.01/
"paste" images to <http://imagebin.ca> from Perl. 
----
WebService-Lucene-0.06
http://search.cpan.org/~bricas/WebService-Lucene-0.06/
Module to interface with the Lucene indexing webservice 
----
XML-DT-0.51
http://search.cpan.org/~ambs/XML-DT-0.51/
a package for down translation of XML files 
----
autobox-2.21
http://search.cpan.org/~chocolate/autobox-2.21/
call methods on builtin types 
----
pfacter-1.11-1
http://search.cpan.org/~sschneid/pfacter-1.11-1/
----
pfacter-1.11-2
http://search.cpan.org/~sschneid/pfacter-1.11-2/
----
pfacter-1.11-3
http://search.cpan.org/~sschneid/pfacter-1.11-3/
Collect and display facts about the system 
----
threads-1.69
http://search.cpan.org/~jdhedden/threads-1.69/
Perl interpreter-based threads 
----
threads-shared-1.17
http://search.cpan.org/~jdhedden/threads-shared-1.17/
Perl extension for sharing data structures between threads 


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: Sat, 23 Feb 2008 08:07:25 GMT
From: nospam@geniegate.com (Jamie)
Subject: Re: Speeding my script
Message-Id: <Lc120375395371720x19dc5b0@saturn>

In <29fba8f0-26f0-4b2e-9dbd-637445719e09@n77g2000hse.googlegroups.com>,
Petyr David <phynkel@gmail.com> mentions:
>have a web page calling PERL script that searches for patterns in 20,
>000 files + and returns link to files and lines found matching
>pattern. I use a call to `find` and `egrep`

That is going to take a long, long time.

>Q: Script works - but is straining under the load - files are in the
>Gbs.
>     How to speed process? How simple to employ threads or slitting
>off
>     new processes?

Thats an option. Check into File::Find, fork() and pipes. You could 
create some pipes, fork several processes, do a select on the handles 
and run the commands in parallel. 

This will still run awfully slow though.

>what I'd like to do is to be able to simultaneously be searching more
>than 1 subdirectory

If you don't need full regex capability, you could check into indices. If you 
know one of the words, you can use that to filter out which documents to scan.

If you can get the words sorted, look into Search::Dict (or, use a tied hash)

Best bet is to use an index though. Even if it's crude, a substantial amount
of your time is probably spent opening and closing files. (well, find/grep anyway)

An example of a "crude index" is the whatis database.

When you type 'apropos keyword' you're not opening a zillion manpages and 
scanning them.

Jamie
-- 
http://www.geniegate.com                    Custom web programming
Perl * Java * UNIX                        User Management Solutions


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

Date: Sat, 23 Feb 2008 12:03:47 +0100
From: Tom Brown <not@home.net>
Subject: Re: Spreadsheet::ParseExcel - How to get certain Cells
Message-Id: <2008022312034716807-not@homenet>

Dear J.,

many many thanks for your assistance. With your explanation it was 
quite easy to get the values I was looking for.

Unfortunatelly, when I invoked the script on the live sheet (what the 
script is intended for), I am facing a new challenge. Before I start to 
describe it, please have a look on the data source/structure:

       [   A   ] [    B     ][          C          ]
[13]     1      Cell_B1  192.168.0.11
[23]     2      Cell_B2  192.168.0.56
[37]     3      Cell_B3  192.168.0.112
[41]     4      Cell_B4  10.10.12.158
[64]     5      Cell_B5  172.17.54.232
[71]     6      Cell_B6  192.168.15.12
[80]     7      Cell_B7  172.17.90.254

As can be seen, the index is not consecutively numbered (due to some 
makros and VBS inside the Excel-sheet). Therefore, column A is the 
point of reference where I have to define the range to get the values 
from column C.

I've tried it already by myself, but I do not get the correct values. 
Here is the failing candidate:

[------------------------start of code--------------------------]
my $oBook = $Excel_file->Parse('devices.xls');
my ($oWkS, $oWkC);

my $iSheet = $oBook->{Worksheet}[4];
        $oWkS = $oBook->{Worksheet}[$iSheet];
        print "--------- SHEET: ", $oWkS->{Name}, "\n"x2;

for my $indexRow ( 3 .. 6 ) {
    my $indexColumn = 1;
    $oWkC = $oWkS->{Cells}[$indexRow][3];
    #print "( $iRow , $iColumn ) =>", $oWkC->Value, "\n" if($oWkC);
    print $oWkC->Value, "\n" if($oWkC);
}
[------------------------End of code--------------------------]

In plaintext: I would like to get the values in column C for the range 
A3 .. A6. So, as result the script should give the following IP 
addresses back:

192.168.0.112
  10.10.12.158
172.17.54.232
192.168.15.12

So, where is my fault?

Once again, many thanks for any assistance.

Tom



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

Date: Sat, 23 Feb 2008 05:29:29 -0800 (PST)
From: Ronny <ro.naldfi.scher@gmail.com>
Subject: Storing references in a hash - why does Perl complain here?
Message-Id: <d801ed6a-4ce8-4bb4-8dfb-a9eaafeb8fbd@b29g2000hsa.googlegroups.com>

I would like to build a hash, where the keys are strings, and the
values are
references (actually, they are references to anonymous hashes). When I
start like this:

my %uts={};
$uts{X}={};

Perl 5.8.6 complains:

  "Reference found where even-sized list expected"

Now I don't question the *content* of this sentence (actually, {} *is*
a reference), but I wonder
why Perl insists in having something like

  $uts{X}=();

instead.  What is wrong in storing a hash reference in a hash? Other
references (I tried references
to numbers, references to arrays, and code references) work fine.

Ronald


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

Date: Sat, 23 Feb 2008 13:45:51 -0000
From: Jeremy Nixon <~$!~( )@( )u.defocus.net>
Subject: Re: Storing references in a hash - why does Perl complain here?
Message-Id: <13s08sf7h62cs9d@corp.supernews.com>

Ronny  <ro.naldfi.scher@gmail.com> wrote:

> my %uts={};
> $uts{X}={};
> 
> Perl 5.8.6 complains:
> 
>   "Reference found where even-sized list expected"
> 
> Now I don't question the *content* of this sentence (actually, {} *is*
> a reference), but I wonder
> why Perl insists in having something like
> 
>   $uts{X}=();
> 
> instead.

It's not complaining about that, it's complaining about the line before it,
which should be

  my %uts = ();

Or simply

  my %uts;

%uts is a hash, not a hash reference; {} is an empty hash reference, which
would be assigned to a scalar variable, not a hash.

-- 
Jeremy Nixon  |  address in header is valid
                (formerly jeremy@exit109.com)


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

Date: Sat, 23 Feb 2008 05:48:45 -0800 (PST)
From: "1usa@llenroc.ude.invalid" <sinan.unur@gmail.com>
Subject: Re: Storing references in a hash - why does Perl complain here?
Message-Id: <a3f0b6fa-3011-4e25-936c-0f03b14ec203@e10g2000prf.googlegroups.com>

On Feb 23, 8:29 am, Ronny <ro.naldfi.sc...@gmail.com> wrote:
> I would like to build a hash, where the keys are strings, and the
> values are
> references (actually, they are references to anonymous hashes). When I
> start like this:
>
> my %uts={};
> $uts{X}={};
>
> Perl 5.8.6 complains:
>
>   "Reference found where even-sized list expected"

That is not the whole error message. It is important to read all that
perl tells you: It should have given you a line number.

perl is complaining about

> my %uts={};

That should have been:

my %uts = ();

But, then, you really do not need the initializer, so

my %uts;

would have been better.

Sinan

--
Cool & cute: http://eeepc.asus.com/global/


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

Date: Sat, 23 Feb 2008 14:20:01 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Storing references in a hash - why does Perl complain here?
Message-Id: <slrnfs0aae.cdl.tadmc@tadmc30.sbcglobal.net>

Ronny <ro.naldfi.scher@gmail.com> wrote:

> I would like to build a hash, where the keys are strings, 


Hash keys are *always* strings.


> and the
> values are
> references (actually, they are references to anonymous hashes). When I
> start like this:
>
> my %uts={};
> $uts{X}={};
>
> Perl 5.8.6 complains:
>
>   "Reference found where even-sized list expected"


Did the complaint include a line number?

Did you pay close attention to which line the message was
referring to?

It is complaining about the 1st line, not the 2nd one.


> Now I don't question the *content* of this sentence (actually, {} *is*
> a reference), but I wonder
> why Perl insists in having something like
>
>   $uts{X}=();
>
> instead.  


That is not what it is insisting on at all, rather it is insisting
on something like:

   my %uts=()
or
   my %uts;

instead.


> What is wrong in storing a hash reference in a hash? 


Nothing.

   What is wrong with storing a hash reference as a hash _key_?

Is a question that applies to your code...


> Other
> references (I tried references
> to numbers, references to arrays, and code references) work fine.


If you had shown us your code using those other types of references,
then we could have explained how and why they are different.

But you didn't, so we can't.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

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 V11 Issue 1301
***************************************


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