Perl Error Pseudo Hashes Are Deprecated
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up troubleshooting “pseudo-hashes are deprecated” while using xml module up vote 3 down vote favorite I am just learning how to use perl hashes and ran into this message in perl. I am using XML::Simple to parse xml output and using exists to check on the hash keys. Message: Pseudo-hashes are deprecated at ./h2.pl line 53. Argument "\x{2f}\x{70}..." isn't numeric in exists at ./h2.pl line 53. Bad index while coercing array into hash at ./h2.pl line 53. I had the script working earlier with one test directory and then executed the script on another directory for testing when I got this message. How do I resolve/workaround this? Code that the error references: use strict; use warnings; use XML::Simple; use Data::Dumper; #my $data = XMLin($xml); my $data = XMLin($xml, ForceArray => [qw (file) ]); my $size=0; if (exists $data->{class} and $data->{class}=~ /FileNotFound/) { print "The directory: $Path does not exist\n"; exit; } elsif (exists $data->{file}->{path} and $data->{file}->{path} =~/test-out-00/) { $size=$data->{file}->{size}; if ($size < 1024000) { print "FILE SIZE:$size BYTES\n"; exit; } } else { exit; } print Dumper( $data ); Working test case, data structure looks like this: $VAR1 = { 'recursive' => 'no', 'version' => '0.20.202.1.1101050227', 'time' => '2011-09-30T02:49:39+0000', 'filter' => '.*', 'file' => { 'owner' => 'test_act', 'replication' => '3', 'blocksize' => '134217728', 'permission' => '-rw-------', 'path' => '/source/feeds/customer/test/test-out-00', 'modified' => '2011-09-30T02:48:41+0000', 'size' => '135860644', 'group' => '', 'accesstime' => '2011-09-30T02:48:41+0000' 'modified' => '2011-09-30T02:48:41+0000' }, 'exclude' => '' }; recursive:no version:0.20.202.1.1101050227 time:2011-10-01T07:06:16+0000 filter:.* file:HASH(0x8
A • B • C • D • E F • G • H • I • L M • N • O • P • S T • U • X perlref Perl 5 version 8.8 documentation Go to top • Download PDF Show page index • Show recent pages Home > Language reference > perlref Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser. To get the best experience, please enable JavaScript or download a modern web browser such as Internet Explorer 8, Firefox, Safari, or Google Chrome. Recently read perlref NAME NOTEDESCRIPTIONMaking References Using References http://stackoverflow.com/questions/7618269/troubleshooting-pseudo-hashes-are-deprecated-while-using-xml-module Symbolic references Not-so-symbolic referencesPseudo-hashes: Using an array as a hash Function Templates WARNING SEE ALSONAME perlref - Perl references and nested data structures NOTE This is complete documentation about all aspects of references. For a shorter, tutorial introduction to just the essential features, see perlreftut. DESCRIPTION Before release 5 of Perl it was difficult to represent complex data structures, because all references had to be symbolic--and even then it was difficult http://perldoc.perl.org/5.8.8/perlref.html to refer to a variable instead of a symbol table entry. Perl now not only makes it easier to use symbolic references to variables, but also lets you have "hard" references to any piece of data or code. Any scalar may hold a hard reference. Because arrays and hashes contain scalars, you can now easily build arrays of arrays, arrays of hashes, hashes of arrays, arrays of hashes of functions, and so on. Hard references are smart--they keep track of reference counts for you, automatically freeing the thing referred to when its reference count goes to zero. (Reference counts for values in self-referential or cyclic data structures may not go to zero without a little help; see Two-Phased Garbage Collection in perlobj for a detailed explanation.) If that thing happens to be an object, the object is destructed. See perlobj for more about objects. (In a sense, everything in Perl is an object, but we usually reserve the word for references to objects that have been officially "blessed" into a class package.) Symbolic references are names of variables or other objects, just as a symbolic link in a Unix filesystem contains merely the name of a file. The *glob notation is something of a symbolic reference. (Symbolic referen
I see that this is a Perl 5.8 change. I am getting this "Pseudo-hashes are deprecated" error while following the Camel Book v3 and trying to generate a count of items in a hash of hashes thus: scalar(keys http://www.thecodingforums.com/threads/pseudo-hashes-are-deprecated-error-and-accessing-a-hash-of-hashes.896355/ %{ $logips{$key} } ) Basically I'm parsing a Web log file and am trying to keep a list of unique IPs that visited each page (modifying Perl Cookbook recipe 4.6) thus: my %logips=(); my %logipseen=(); foreach $snifferlog (@ARGV) { blah blah blah; push (@{ $logips{$logfile} }, $logip) unless ( $logipseen{ $logfile }{ $logip } )++; } foreach $key (@logfiles) { print scalar(keys %{ $logips{$key} } ); So $logips{$key} should have a hash of all the unique IPs in perl error it, I just want a quick count, but I'm having trouble with the hash of hash syntax. Apparently the older syntax in the camel book's not good any more and I've fiddled aroudn with this a while and read Web tutorials on hashes of hashes without luck. Any help welcome! Thanks, Ernest , Jan 30, 2006 #1 Advertisements Ch Lamprecht Guest Re: "Pseudo-hashes are deprecated" error and accessing a hash ofhashes schrieb: > OK, so I see that perl error pseudo this is a Perl 5.8 change. I am getting this > "Pseudo-hashes are deprecated" error while following the Camel Book v3 > and trying to generate a count of items in a hash of hashes thus: > > scalar(keys %{ $logips{$key} } ) > > Basically I'm parsing a Web log file and am trying to keep a list of > unique IPs that visited each page (modifying Perl Cookbook recipe 4.6) > thus: > > my %logips=(); > my %logipseen=(); > foreach $snifferlog (@ARGV) { > blah blah blah; > push (@{ $logips{$logfile} }, $logip) unless ( ------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ that's a hash of arrayrefs > $logipseen{ $logfile }{ $logip } )++; > } > foreach $key (@logfiles) { > print scalar(keys %{ $logips{$key} } ); print scalar @{ $logips{$key} }; > > So $logips{$key} should have a hash of all the unique IPs in it, I just > want a quick count, but I'm having trouble with the hash of hash > syntax. Apparently the older syntax in the camel book's not good any > more and I've fiddled aroudn with this a while and read Web tutorials > on hashes of hashes without luck. Any help welcome! > > Thanks, > Ernest > HTH Christoph -- perl -e "print scalar reverse q//" Ch Lamprecht, Jan 30, 2006 #2 Advertisements Paul Lalli Guest wrote: > OK, so I see that this is