When I used suggestion given by moritz my $count = 0; while( <$fh> ) { $count++; } I was unable to get content of file. I think the reason for this was that you cant reuse file handle. Can anyone tell me why this is so?
You've read in the entire file. The pointer is at the end of the file. Use seek to rewind. Or, if it's your intention to suck in the entire file anyway, do it on the first pass.
I tried to use this $content = ` wc -l $Filehandle` but I could not get output in $count as it should be.
Out of Define "did not work". What did you try? What did you get? What did you expect? Did you get an error? If so, what was it? What did you try to fix the error? you only answered the first question. Partially. $Filehandle sounds very fishy - is that a file handle, or does the variable $Filehandle actually contain the name of the file?
This worked fine on command prompt bt not on browser.
I give you one more chance: what did happen? Did you get an error? If so, which error? Check your error log as well. Or do you have some miracle wc which says, "Hmmm, I'm called by code written by Prafull. When he's running interactively I'm going to behave. But when it's run from a webserver, I'm going to return a random number!"?

In reply to Re^3: no of lines in uploaded text file by JavaFan
in thread no of lines in uploaded text file by prafull

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.