Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: XML file creation based on file existence

by Anonymous Monk
on Dec 28, 2009 at 04:29 UTC ( [id://814571]=note: print w/replies, xml ) Need Help??


in reply to XML file creation based on file existence

in your code:

  • Your data are not linked to each others in any way
  • Although you used 'my' to declare some of your variables at the very top of your script, Those are now global variables which is something you do not need to do in your case.
  • Consider adding use strict; use warnings; at the top of your code
  • split function returns an array you can access it's elements by supplying the ids counting from zero
    my ($X,$Y,$Z) = (split/_/,$file)[2.3,4];
    or if you don't like using those numbers consider using undef for the element you don't need rather than using a bogus variable $unwanted <code> my (undef,undef,$X,$Y,$Z) = split /_/,$file;
  • in perl you should use 'eq' and/or 'ne' for strings comparison and I as I can see you are using numerical comparison when comparing the date to an empty string which is wrong

Hopes those comments will help you out.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://814571]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found