Gunnar Hjalmarsson wrote:
John W. Krahn wrote:
Could you please explain how the code I posted does not accomplish the
OP's objectives or is inefficient?
Well, to me it seems like the pre-defined sentences, including the
undesired newline symbols, are not part of the data that is read by the
John W. Krahn wrote:
Gunnar Hjalmarsson wrote:
John W. Krahn wrote:
A more efficient method is to read and write one line at a time:
$\ = ' '; # set Output Record Separator to a space
while ( <> ) {
$\ = "\n" if eof;
chomp;
print;
}
That may be an efficient solution to some
Gunnar Hjalmarsson wrote:
John W. Krahn wrote:
Ryan wrote:
Gunnar Hjalmarsson wrote:
One way to do that is to store the sentences in an output array
instead of printing them directly.
Within the while loop:
push @output, ...;
And then:
chomp @output;
print "@output\n";
This
John W. Krahn wrote:
Ryan wrote:
Gunnar Hjalmarsson wrote:
One way to do that is to store the sentences in an output array
instead of printing them directly.
Within the while loop:
push @output, ...;
And then:
chomp @output;
print "@output\n";
This approach did the job. Than
Ryan wrote:
Gunnar Hjalmarsson wrote:
One way to do that is to store the sentences in an output array
instead of printing them directly.
Within the while loop:
push @output, ...;
And then:
chomp @output;
print "@output\n";
This approach did the job. Thanks.
A more effici
This approach did the job. Thanks.
--Chris Ryan
Gunnar Hjalmarsson wrote:
Chas. Owens wrote:
On Jan 6, 2008 7:48 PM, Ryan <[EMAIL PROTECTED]> wrote:
I have a small piece of a program which loops through lines of data,
using the construct, one line at a time, and prints different
pre-defined
Chas. Owens wrote:
On Jan 6, 2008 7:48 PM, Ryan <[EMAIL PROTECTED]> wrote:
I have a small piece of a program which loops through lines of data,
using the construct, one line at a time, and prints different
pre-defined sentences, contingent upon what is found in each line of
data. The data are
In addition to what Chas said, you may also want to add a space after
each sentence.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Jan 6, 2008 7:48 PM, Ryan <[EMAIL PROTECTED]> wrote:
> I have a small piece of a program which loops through lines of data,
> using the construct, one line at a time, and prints different
> pre-defined sentences, contingent upon what is found in each line of
> data. The data are in the progra