Re: Joining 2 strings

From: Eric Bohlman (ebohlman_at_omsdev.com)
Date: 08/11/04


Date: 11 Aug 2004 05:26:39 GMT

selena_kid@yahoo.com (Sim) wrote in
news:82bbfd98.0408101451.69866dfa@posting.google.com:

> I managed to solve the problem! It is very similar to the solution Jue
> posted. Here's how it goes. I wish to thank everyone who has thought
> through this problem. My MSN is jjsimz@hotmail.com. I am a college
> Physics student, and if you have any physics question, I might be of a
> little help. =)
>
>
> #!/usr/bin/perl
> use strict;

You want 'use warnings;' here as well.

>
> open (FILE, 'sample.out') or die "could not open 'sample.out'!!! ";
> open (OUTPUTFILE, '>>output.out') or die "could not open
> 'output.out'!!! ";

Error messages for files should say *why* the file couldn't be opened;
stick a $! in both messages.

> while (<FILE>) {
> s/^\s*((.*\S)?)\s*$/$1/; #removes spaces before and after the
> string

The FAQ recommends doing this in two substitutions (neither of which
requires capturing) rather than one; it's usually faster.

> print (OUTPUTFILE $_, ' ');
> if ($. % 3 == 0) {print (OUTPUTFILE "\n")}
> }
> close FILE;
> close OUTPUTFILE;



Relevant Pages

  • Re: Gaim
    ... However if you posted some symptoms, error messages, etc. ... When I log to MSN I get the message: ... Working with Mozilla 1.6 on Redhat Linux Fedora Core 1 ...
    (Fedora)
  • damaged Microsoft registry key
    ... I've recently been having problems with Microsoft Internet Explorer and MSN ... them script error messages, although I haven't been able to access my mail ... using MSN messenger or view peoples profiles etc. ...
    (microsoft.public.windowsxp.general)
  • Re: Cantt verify my new email address
    ... I just received the verification email from msn. ... regards. ... Hugo Amselschlag wrote: ... > times and never received any error messages. ...
    (microsoft.public.windowsxp.messenger)
  • Re: Using PPC without SIM Card?
    ... >My XdaIIs seems unhappy when it doesn't have its normal SIM card in ... >it - it keeps throwing up error messages. ... >This is even though I can use the Orange SIM quite happily in other mobile ...
    (microsoft.public.pocketpc.phone_edition)