Re: Joining 2 strings
From: Sim (selena_kid_at_yahoo.com)
Date: 08/11/04
- Next message: Ilya Zakharevich: "Re: split inconsistency- why?"
- Previous message: Alan J. Flavell: "Re: passing param('something') through a function"
- In reply to: Jürgen Exner: "Re: Joining 2 strings"
- Next in thread: Eric Bohlman: "Re: Joining 2 strings"
- Reply: Eric Bohlman: "Re: Joining 2 strings"
- Reply: Joe Smith: "Re: Joining 2 strings"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 10 Aug 2004 15:51:24 -0700
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;
open (FILE, 'sample.out') or die "could not open 'sample.out'!!! ";
open (OUTPUTFILE, '>>output.out') or die "could not open
'output.out'!!! ";
while (<FILE>) {
s/^\s*((.*\S)?)\s*$/$1/; #removes spaces before and after the
string
print (OUTPUTFILE $_, ' ');
if ($. % 3 == 0) {print (OUTPUTFILE "\n")}
}
close FILE;
close OUTPUTFILE;
- Next message: Ilya Zakharevich: "Re: split inconsistency- why?"
- Previous message: Alan J. Flavell: "Re: passing param('something') through a function"
- In reply to: Jürgen Exner: "Re: Joining 2 strings"
- Next in thread: Eric Bohlman: "Re: Joining 2 strings"
- Reply: Eric Bohlman: "Re: Joining 2 strings"
- Reply: Joe Smith: "Re: Joining 2 strings"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]