hi there

i'm trying to split a string from a line of text in a file - the split
delimiter is a tab character '\t' - i then need to compare the 2 bits on
either side of the tab to see if they are equal - if not eq - i write to
tidy else i write to mess

? confused - this bit of code is giving me empty files ?


while (<INPUT>)


{


 next if ($_=~/^\#/); #if line begins with a #
 next if ($_=~/^\s*(\#|$)/); #if line is blank


 if ( $_ =~/\w/)
 {print MESS "$_"}


 if ( $_ !~/[A-Za-z]/)
     {print MESS "$_"}
 else {print TIDY "$_"}

 # split the string into 2 parts string 1, 2 separated with a tab.

 @_= split(/\t/,$_);

 # compare the first element of the list with the last element.

 if (@_[0] eq @_[1])
{print MESS "$_"}
 else { print TIDY "$_"}

}



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to