Thank you. Now I see where I`m wrong. More than one result is output of glob but I insert them to variable but should be inserted to table.
I`ve fixed it to @files
foreach (@ext) {
my @load = glob "$data*.$_";
push (@files, @load);
}
but still first element of @files table is empty.
The output:
2012-03-02-09-46-09: Found database:
2012-03-02-09-46-09: Found database: /opt/databases/DEMO.fb
2012-03-02-09-46-09: Found database: /opt/databases/demo2.fb
2012-03-02-09-46-09: Found database: /opt/databases/demo.gdb
2012-03-02-09-46-09: Found database: /opt/databases/demo2.gdb
2012-03-02-09-46-09: Found database: /opt/databases/demo3.gdb
2012-03-02-09-46-09: Found database: /opt/databases/simplemarketing.g
+db
2012-03-02-09-46-09: Found database: /opt/databases/SimpleMarketing2.
+gdb
The script dies at first element because gbak can`t perform backup on empty file as source.
For now to cut out the first empty element from @files i`ve just used
shift(@files); but I`m not sure is this a good idea.
I don`t know why it push first element empty to @files and if in some conditions e.g. on other server the first element will not be empty the shift will be cutting out one of databases from backup.
Is there a better way to check array for empty elements and if exist shift them? I have two ideas - insert if in foreach loop or do another one foreach loop for @files to remove the empty elements. In both ideas I don`t know how to correctly detect empty elements.
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.