in reply to Parsing Header Last Field

Dear All, thank you very much!
After chomp'ing the input and changing from $i <= @parts to $i < @parts it works now!

I also changed

 unshift @Assembly, $Header;
to
unshift @Assembly, $Header."\n";
since the first row sticks on the header otherwise.
However I could not do it without while (<DATA>)-loop. I am a newbie thus please do not beat me, but the code of toolic works by me only after I returned the while(<DATA>)-loop back.

In fact, this loop is necessary anyway since I process the files not the DATA-snippet, this was just an example.

You are right, this anonymizing is very primitive, but this is just a fool-proofing and is sufficient in this case, it is not necessary to protect this data from the hacker attack.

And: unfortunately I can work with the standard installation of perl only, I cannot install the other modules - it is just a policy here. Too bad.

Thank you all very much again. If you find another mistakes in this snippet of code it would be grate.

VE

Replies are listed 'Best First'.
Re^2: Parsing Header Last Field
by toolic (Bishop) on Jul 05, 2011 at 16:06 UTC
    You're welcome.
    And: unfortunately I can work with the standard installation of perl only, I cannot install the other modules - it is just a policy here. Too bad.
    Are you sure about that? See: Yes, even you can use CPAN
      Thank you again, I will try it.
Re^2: Parsing Header Last Field
by Anonymous Monk on Jul 05, 2011 at 20:36 UTC

    However I could not do it without while (<DATA>)-loop

    Sure you can, simply shift the first, empty (all whitespace) line before the header -- you don't need a loop for that

    <DATA> is readline DATA, and readline in scalar context reads one line