I am making a PDF , which using PDF::Table I am making a table inside that PDF.
What I am trying to do is make the table dynamic, cause I am passing variables and I do not want a blank table row if the variable is empty. This is what I have tried so far:
my $some_data =[
["HP Hardware", "Total Cost"],
[$hardware1, $hardwareValue1],
[$hardware2, $hardwareValue2],
[$hardware3, $hardwareValue3],
[$hardware4, $hardwareValue4],
[$hardware5, $hardwareValue5],
[$hardware6, $hardwareValue6],
[$hardware7, $hardwareValue7],
[$hardware8, $hardwareValue8],
[$hardware9, $hardwareValue9],
[$hardware10, $hardwareValue10],
[$hardware11, $hardwareValue11],
[$hardware12, $hardwareValue12],
[$hardware13, $hardwareValue13],
[$hardware14, $hardwareValue14],
[$hardware15, $hardwareValue15],
];
for (my $i=0; $i< scalar($some_data); $i++) {
if ($hardware[$i] eq "") {
}
}
I am thinking if the variable is blank I want to delete the row from $some_data, I don't know the syntax to do it,
I also Tried
my @tableData = $some_data;
for (my $i=0; $i< scalar(@tableData); $i++) {
my @row = $tableData[$i];
for ( my $j=0; $j< scalar(@row) ;$j++) {
my $cell = $row[$j];
if (($cell eq "") || ($cell eq " ")) {
splice(@tableData, @row, @row)
}
}
}
Any help or suggestions would be helpful, thanks
Ben
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.