I have been trying to streamline some code and have run into a little problem. I can't figure out how to combine or simplify the following: (sample data:
$record = " 100.100.100.100 1COMPUTER1 09/13/30828 22:48:05";)
$ipadrs = substr($record,0,17)) =~ s/ //g;
@iparray = split(/\./,$ipadrs);
I tried this:
@iparray = split(/\./,(substr($record,0,17) =~ s/ //g));
And this
@iparray = @{split(/\./,(substr($record,0,17) =~ s/ //g))};
Not to mention a few others that were really silly. None of which worked. I've just been guessing at this and I'm not getting any closer to an answer. Perhaps there is no merit in this considering it's only two simple lines of code, but it would be nice to see how this can be done. I would greatly appreciate it if someone could lead me in the right direction.
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.