Wrap your code in
<code> tags. Separate your paragraphs with
<p> tags. Given that you are asking for help, it is incredibly rude of you to make me go through and reformat your code. For example, note how all your array indices have been transformed to links. In order to run your code, I have to go through and add square brackets by hand. Do you really value my time so little that you cannot type a few extra letters? I am a very patient person (as are most people on this site), but your lack of consideration is wearing my patience thin.
Your code is horribly formatted from your post and you have not given me the contents of C:\sun\pat, so some of my comments may be off point.
- You are performing an open without testing if it worked. Perl will fail silently if something went wrong with the open. An open statement should look like open FH, "<", "C:\\sun\\pat" or die "Open failure: $!";. See perlopentut.
- You don't seem to understand how string interpolation works in Perl - you have a lot of unnecessary concatenation. See Quote and Quote like Operators in perlop
- You appear to be parsing your strings character by character. There is almost never a reason to do this in Perl. You could accomplish your task with regular expressions (perlretut), but if you are working with paths, it is always easier to use someone else's well-tested code. As I posted originally, File::Spec does everything you need.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.