Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re: XML file creation based on file existence by Anonymous Monk
in thread XML file creation based on file existence by valavanp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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-03-28 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found