Hi Corion,

Thanks for reply. Yes i will use foreach loop.My input is a file with all the entries, for eg:

/home/shekarkcb/abc/ /home/shekarkcb/def/ /home/shekarkcb/abc/
I got to do these things

1)Read Each entry from file, go to that folder, find *END*txt. if found then delete a entry from file.
2)If not found then do a next till finds *END*txt.

I have used Arrays for these.
-> First open file, put all entry in an array.
-> while array (@array_LAST_MOD_FILE) length not equals to 0, for each of that entry (used c style for loop as you mentioned) i.e for each directory used find to 'find' the file *END*txt, and stored result in an array.
-> Again checking the length of it is 0 means no result obtained (no END file),
if not 0 then yes got END file inside that directory so delete the entry from @array_LAST_MOD_FILE,

Here is what the problem, i will delete the entry here, but outer while still has the entry.so it is going to infinite. Hope now you got the problem. Please suggest me a soln or a better way to do this.

Thanks,ShekarKCB

In reply to Re^2: Manipulating Arrays by shekarkcb
in thread Manipulating Arrays by shekarkcb

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.