Got it sorted!
I had already put the \n on the line before printing with no success, but
I followed chomp with a chop, and it worked a treat!
I think that chomp was removing the Carriage return but not line feed (maybe
the other way round), the chop just removes the last character (which after
chomp'ing would be the line feed) I think that's whats going on anyway!
Thanks for all your help
Terry Honeyford
On Fri, 25 Jan 2002, IT Workflow - Terry Honeyford wrote:
> I am trying to print out only the lines that begin with Either "Unable to
> attach to", OR "Backup of"
> and append to the line "NOT OK" or "OK" depending on which match I get
> Here is the offending bit of script...
>
> open (FILE, "</path/to/file")or die "can't open file $!";
>
> while (<FILE>){
> chomp;
chop; #removes last character on line
> if (m/^Unable to attach to/){
$line .= "$_ \t NOT OK\n";
> }elsif{
> (m/^Backup of/){
$line .= "$_ \tOK\n";
> }
> }
> Print $line;
>
> if I dont chomp $_ then I get the OK/Not OK message on the line below,
> if I do use chomp I get the first 7 characters of the Original line then
the
> "OK/Not Ok" the original line the continues as though the OK/Not OK has
> overprinted it!
Just append "\n" to the line when you print it.
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
Is there life before breakfast?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]