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 6623019
In Process

The Archive Base Latest Questions

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

Problem: Seeing exists argument is not a HASH or ARRAY element Need help setting

  • 0

Problem:
Seeing exists argument is not a HASH or ARRAY element
Need help setting up several conditions to grab the right key.

Code: (I’m not sure also if my conditions are set up correctly. Need advice troubleshooting)

my $xml = qx(@cmdargs);
my $data = XMLin($xml);
my $size=0;

# checking for error string, if file not found then just exit
# otherwise check the hash keys for filename and get its file size
if (exists $data->{class} =~ /FileNotFound/) {
       print "The directory: $Path does not exist\n";
        exit;
          } elsif (exists $data->{file}->{path}
                      and $data->{file}->{path} =~/test-out-XXXXX/) {   
                    $size=$data->{file}->{size};
                      print "FILE SIZE:$size\n";
          } else {
        #    print  "Nothing to print.\n";
     }
     # print "$data"; 
print Dumper( $data );

My Data:
Data structure for xml file with FileNotFound:

$VAR1 = {
          'file' => {},
          'path' => '/source/feeds/customer/testA',
          'class' => 'java.io.FileNotFoundException',
          'message' => '/source/feeds/customer/testA: No such file or directory.'
        };

Data structure for xml file found:

$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-00000',
                        'modified' => '2011-09-30T02:48:41+0000',
                        'size' => '135860644',
                        'group' => '',
                        'accesstime' => '2011-09-30T02:48:41+0000'
                      },
  • 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:28:59+00:00Added an answer on May 25, 2026 at 9:28 pm

    The interpreter is probably thinking you meant:

    exists($data->{class}=~/FileNotFound/)  
    

    Try:

    exists $data->{class} and $data->{class}=~/FileNotFound/
    

    instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am seeing a strange problem: I have a linux machine, installed JDK1.6 on
I'm seeing a strange problem when calling Win32 GDI Polyline() when printing out. On
I have this problem in my ASP.NET application where I'm seeing some of my
I detected this problem when updating the patterns in URLConf and seeing that the
So, I am seeing a curious problem. If I have a function // counter
We've been seeing this problem for a while now and I'm really trying to
I am seeing a problem with reusing my http-client after an HttpPost's execute fails.
I am having a problem with seeing subclass attributes in an ArrayList. Here's some
Problem: I have an address field from an Access database which has been converted
Problem: I have two spreadsheets that each serve different purposes but contain one particular

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.