Hi,
I have the following code:
my $l = "WINGFRAME MACH1;VECTORTHRUST 40 00 40 40;VECTORTHRUST 60 00
+40 90;VECTORTHRUST 10 40 30 10;VECTORTHRUST 80 10 10 10;VECTORTHRUST
+60 10 95 00;VECTORTHRUST 70 00 60 00;VECTORTHRUST 80 00 70 90;VECTORT
+HRUST 60 50 80 90;VECTORTHRUST 60 40 80 10;WINGFRAME MACH2;VECTORTHR
+UST 40 00 40 40;VECTORTHRUST 60 00 40 90;VECTORTHRUST 10 40 30 10;VEC
+TORTHRUST 80 10 10 10;VECTORTHRUST 60 10 95 00;VECTORTHRUST 70 00 60
+00;VECTORTHRUST 80 00 70 90;VECTORTHRUST 60 50 80 90;VECTORTHRUST 60
+40 80 10;";
my @a = split(/WINGFRAME /,$l);
foreach (@a) {
print $_,"\n";
}
print scalar (@a),"\n";
When I run the above code,we see there is a "blank value" for $a[0].
Why does split function put blank value into the array?
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.