in reply to Re^10: tab delimited extraction, formatting the output
in thread tab delimited extraction, formatting the output

why ... $mc_value being printed ... after $p_value and not infront ...

That's the order you are printing in, isn't it?

if ($mc_value) { print "\t" . ' ' x length $p_value;} $mc_value=$line; print "\t$mc_value";

should I put OUT infront of every print

Yes, or you can select OUT; before your first print statement. That selects OUT as the default filehandle for output.

Another suggestion. You have instances like this:

} elsif ($line=~/\bProcessing\s/) { $line=~s/\bProcessing\s\d+\.tx\.\d+: //; $u_value = $line;

Which could be simplified:

} elsif ($line=~s/\bProcessing\s\d+\.tx\.\d+: //){ $u_value = $line;

And you could simplify throughout with $_ instead of $line, but that's a matter of preference.

Replies are listed 'Best First'.
Re^12: tab delimited extraction, formatting the output
by zzgulu (Novice) on Feb 13, 2009 at 21:19 UTC
    yes, that's the order and I get
    $u_value
    <tab>$p_value
    <tab>$mc_value

    while I want to get
    $u_value
    <tab>$p_value<tab>$mc_value

    Thanks

      Try adding chomp $line; after your while statement.

        Thank you for the help. I used chomp exactly before $mc_value if condition but obviously the location was wrong.
        Also, thank you for the select OUT hint, it's a life saver :) Really do appreciate your prompt reply and great help