Hi all,

Using command line, i am running this program. It's working properly. But i have a problem. While displaying the usernames under the "users" folder, i am getting same username (multiple entries). It's because of username contails another folders. How can i solve this problem.

Structure as :
/home/sites/abc.com/users/AB/ /home/sites/abc.com/users/CD/ /home/sites/abc.com/users/CD/asd/ /home/sites/abc.com/users/CD/ghf/ /home/sites/abc.com/users/EF/sss/ /home/sites/abc.com/users/EF/bc/

Now , reusult will be stored in the array @store. Array contains ('AB','CD','CD','CD','EF','EF')

But i need a result stored in the array as ('AB','CD','EF')

How can i do that. Waiting for help from perl experts.

Pls go through this code.

#!/usr/bin/perl $arg1 = $ARGV[0]; @filelist = ` find /home/sites/$arg1/users -type d `; chomp @filelist; @store = (); foreach $fle(@filelist) { ($junk, $reqd )=split (/\/users\//,$fle); ($reqd, $junk) = split (/\//,$reqd); push (@store,$reqd); }
Regards,
skum

20030214 Edit by Corion - fixed formatting, even though this is a duplicate


In reply to (duplicate) Help by Anonymous Monk

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.