Just another possible alternatives. If what you want to test is a filehandle size
you can use Perl's
-s function.
my $q = new CGI;
my $filehandle = $q->upload("file");
my $fsize = -s $filehandle;
my $fsize_limit = 1000;
# Then you use conditional to check them:
if ($fsize > $fsize_limit) {
# do whatever you want
}
If it the file is tied to a variable you can simply use
length function:
# let's say you have a data captured in textrea
textarea(
-name => 'sequence',
-rows => 10,
-columns => 50,
-wrap => 'physical'
),br
# then you would need to store it into a variable
my $seq_var = param('sequence');
# Size of the variable is captured this way:
my $fsize = length($seq_var);
if ($fsize > $fsize_limit) {
# Do whatever you want
}
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.