Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6626627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:54:52+00:00 2026-05-25T21:54:52+00:00

I am just learning how to use perl hashes and ran into this message

  • 0

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(0x84c83ec)
path:/source/feeds/customer/test
directory:HASH(0x84c75d8)
exclude:

Data structure with seeing error:

$VAR1 = {
          'recursive' => 'no',
          'version' => '0.20.202.1.1101050227',
          'time' => '2011-10-03T04:49:36+0000',
          'filter' => '.*',
          'file' => [
                    {
                      'owner' => 'test_act',
                      'replication' => '3',
                      'blocksize' => '134217728',
                      'permission' => '-rw-------',
                      'path' => '/source/feeds/customer/test/20110531/test-out-00',
                      'modified' => '2011-10-03T04:47:46+0000',
                      'size' => '121406618',
                      'group' => 'feeds',
                      'accesstime' => '2011-10-03T04:47:46+0000'
                    },

Test xml file:

<?xml version="1.0" encoding="UTF-8"?><listing time="2011-10-03T04:49:36+0000" recursive="no" path="/source/feeds/customer/test/20110531" exclude="" filter=".*" version="0.20.202.1.1101050227"><directory path="/source/feeds/customer/test/20110531" modified="2011-10-03T04:48:19+0000" accesstime="1970-01-01T00:00:00+0000" permission="drwx------" owner="test_act" group="feeds"/><file path="/source/feeds/customer/test/20110531/test-out-00" modified="2011-10-03T04:47:46+0000" accesstime="2011-10-03T04:47:46+0000" size="121406618" replication="3" blocksize="134217728" permission="-rw-------" owner="test_act" group="feeds"/><file path="/source/feeds/customer/test/20110531/test-out-01" modified="2011-10-03T04:48:04+0000" accesstime="2011-10-03T04:48:04+0000" size="127528522" replication="3" blocksize="134217728" permission="-rw-------" owner="test_act" group="feeds"/><file path="/source/feeds/customer/test/20110531/test-out-02" modified="2011-10-03T04:48:19+0000" accesstime="2011-10-03T04:48:19+0000" size="125452919" replication="3" blocksize="134217728" permission="-rw-------" owner="test_act" group="feeds"/></listing>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:54:52+00:00Added an answer on May 25, 2026 at 9:54 pm

    The “Pseudo-hashes are deprecated” error means you’re trying to access an array as a hash, which means that either $data->{file} or $data->{file}{path} is an arrayref.

    You can check the data type by using print ref $data->{file}. The Data::Dumper module may also help you to see what is in your data structure (perhaps while setting $Data::Dumper::Maxdepth = N to limit the dump to N number of levels if the structure is big).

    UPDATE

    Now that you are using ForceArray, $data->{file} should always point to an arrayref, which may possibly have multiple references to path. Here is a modified segment of your code to handle that. But note that the logic of the if-then-exit conditions may have to change.

    if (defined $data->{class} and $data->{class}=~ /FileNotFound/) {
        print "The directory: $Path does not exist\n";
        exit;
    }
    
    exit if ! defined $data->{file};
    
    # filter the list for the first file entry named test-out-00
    my ( $file ) = grep { 
        defined $_->{path} && $_->{path} =~ /test-out-00/ 
    } @{ $data->{file} };
    
    exit if ! defined $file;
    
    $size = $file->{size};
    if ($size < 1024000) {
        print "FILE SIZE:$size BYTES\n";
        exit;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just learning Perl. When is it advisable to use OO Perl instead of
Question abstract: how to parse text file into two hashes in Perl. One store
I've just started learning how to use pygame yesterday. I was read this one
I am just learning how to use Terracotta after discovering it about a month
Im just learning SQLite and I can't get my parameters to compile into the
I'm just learning to use RVM, and would like to know how I can
I am just starting learning to use yii , and already managed to do
I'm stil pretty new to regular expression and just started learning to use awk.
I am just learning to use the Entity framework and I wondered how I
I am just learning how to use classes in my projects. I have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.