Just use the stat() to get the size and other information of a file:

my $file_size = (stat($file_path))[7] ;

The full list:

@FL_stats = stat ("") ; # Geting stats of file. $FL_Dev = $FL_stats[0] ; # Device that the file resides on. $FL_Inod = $FL_stats[1] ; # Inode for this file. $FL_Mode = $FL_stats[2] ; # Permissions for the file. $FL_NbLink = $FL_stats[3] ; # Number of hard links to the file. $FL_UID = $FL_stats[4] ; # Numerical user ID for the file owner +. $FL_GID = $FL_stats[5] ; # Numerical group ID for the file owne +r. $FL_TypDev = $FL_stats[6] ; # Device type if the file is a device. $FL_size = $FL_stats[7] ; # Size of the file in bytes. $FL_AcTime = $FL_stats[8] ; # When the file was last accessed. $FL_MdTime = $FL_stats[9] ; # When the file was last modified. $FL_ChTime = $FL_stats[10] ; # When the file status was last change +d. $FL_BlkSize = $FL_stats[11] ; # The optimal block size for i/o opera +tions on the file system containing the file. $FL_Blocks = $FL_stats[12] ; # The number of clocks allocated to th +e file.

"The creativity is the expression of the liberty".

In reply to Re: comparing size by gmpassos
in thread comparing size by splitOnce

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.