I am reading in strings from an outside file. Each line has the same number of characters and the same data in the same position within the string. I used the following code to separate the characters into varables:
($beginning,$agency,$district,$ssn,$serv_per_m,$serv_per_y,$serv_per_t
+,$last_name,$first_name_i,
$middle_name_i,$cover_group, $pay_code, $pay_rate, $earnings, $holder,
+ $ret_percent,$surv_ben,
$work_sch_code,$cont_amt,$cont_code,$stuff) =
/(\d)(\d{4})(\d{3})(\d{9})(\d{2})(\d{2})(\d)(\D{10})(\D)(\D)(\d{5})(\d
+{2})(\d{8})(\d{6}\D)(\s{8})(\d{4})(\d{3})(\d{3})(\d{5}\D)(\d{2})(.*\s
+)$/;
The variables are listed on three lines but the regular expresions are all listed on one long line. I then run a loop to read each line and print several of the variables just to see how it's workiing. It works as desired for several lines then a couple of lines will produce the following error:
Use of uninitialized value $last_name in concatenation (.) or string a
+t final_check.pl line 47, <> line 14
Then it will print several lines correctly and then some more of the error messages.
I am currently running PERL 5.10.0 built for MSWin32-x86-multi-thread (with 3 registered patches)
Any suggestions?
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.