saintmike answered your question. But by the way, it looks like you want a data structure you can easily and efficiently use to determine membership of a particular value. In this case, a hash can be useful:
my %sheets;
[...]
# The next three methods are equivalent. Pick whichever you like most.
# 1
if (not exists $sheets{$machine_sheetname}) {
$sheets{$machine_sheetname} = 1; # "1" is just a dummy existenc
+e flag
}
# 2
$sheets{$machine_sheetname} = 1 unless $sheets{$machine_sheetname};
# 3
$sheets{$machine_sheetname} ||= 1;
Then, when you need all the sheets, use this expression:
keys %sheets;
The prime limitation of this approach, however, is that hashes are not sorted. If the order of your sheets matter, this may not be appropriate after all, or, if you do want to use them, you need to use something like Tie::IxHash.
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.