Hi there,
I am trying to process a small file to output some contents out of it. My input file is as below:
model_techlib \ -tech_lib_file libfile.teclib \ -device_name 12x3X1V1 -variation 0.25 output_setup \ -device_file_name 12x3X1V1DEVFILEDONOTTOUCH \ -map_file_directory_name ./ processing_setup \ -statistics_conversion_map \ A1 B1 \ CC1 DD1 \ A2 B2 \ A3 B3 \ A4 Bl4 \ A5 B5 \ A6 B6\ A56 Z56 variation_input_db \ -type signsample \ -PHI_file ../12x3X1V1.PHI \ -PHI_LIBRARY_LIST PHI_LIB.list sampling -type ORTHOSAMPL results_database \ -type PHI \ -print_sigma true print_gmm -remove_non_convergence true \ -merge_asymptoses true print_gmm_sigma -total_sigma_limit 1.0 solve \ -samples all \ -type PHI #solve \ #-samples all \ #-type PHI

My Perl program to process the above file is as shown below:
#!/usr/bin/perl use strict; use warnings; open(IFH,"<","testlib.tcl") || die "Cannot open input file","\n"; my $line =""; my $cmd =""; my @arrC = (); while(<IFH>) { next if(/^#/g); next if(/^\n/g); s/^\s+//g; if(/\\\s*$/) { s/\\\s*//g; chomp; $line .= $_; } else { $line .= $_; } } #print $line; my @arr = split(/\n/,$line); my @test = (); foreach (@arr) { if(/variation_input_db/) { s/variation_input_db\s*//g; @test = split(/-/,$_); } } foreach (@test) { print $_,"\n"; }

The above file is saved as "test.pl". I executed the program as below:
neal@alnz1:~/JUNK/JUNK1$ ./test.pl

The output from the file always shows the first line as a blank line followed by the other elements of the array as below:
type signsample PHI_file ../12x3X1V1.PHI PHI_LIBRARY_LIST PHI_LIB.list neal@alnz1:~/JUNK/JUNK1$

can some one please help why I see a blank element in my array @test ?
Thanks to you all.
Neal

In reply to blank line in array printing by auckland

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.