Hi Marshall, Thanks for your reply and suggestion. I tried as you said as shown below
#!/usr/bin/perl use warnings; use strict; use XML::Simple; use Carp; use File::Find; use File::Spec::Functions qw( canonpath ); use Data::Dumper; my %hash; my $default_dir = "C:/Main/work"; if (@ARGV == 1) { $default_dir = shift @ARGV ) elsif (@ARGV >1) { die "too many command line args\n"; }; find( sub { return unless ( /(_service\.xml)$/ and -f ); Hash_information(); return; }, @ARGV ); sub Hash_information { my $path= $_; my $xml = new XML::Simple; my $data = $xml->XMLin("$path", ForceArray => [ 'Service','SystemReact +ion','SW','HW','Component' , 'BM'],); return; }
I don't know how to add file path to hash? and also you suggested me define one hash with larger scope so I defined one hash and I don't know how to store this $data into %hash. Can you help me. Don't hesitate me I am new to perl.
In reply to Re^2: How to get file path into hash data structure.
by veerubiji
in thread How to get file path into hash data structure.
by veerubiji
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |