On May 30, David Gilden said:
>$data = 'some
>multi line
>string';
>
>while($data){
> push(@everyline, $_);
>}
You're confusing this with
while () {
# do something with $_;
}
You can do:
@lines = split /\n/, $data;
or you can download the IO::String module from
1) better use
$data = < The following seems to never break out of the loop,
> any comments?
> Thanks
>
> Dave
>
> #!/usr/bin/perl -w
>
>
> $data = 'some
> multi line
> string';
>
>
> while($data){
>
>push(@everyline, $_);
>
> }
--
Ondrej Par
Internet Securities
Software Enginee
Michalski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 1:31 PM
To: David Gilden
Cc: [EMAIL PROTECTED]
Subject: Re: iinfinite loop
Because the while loop will loop for as long as $data is "true" or contains
data Considering that it has data in it, you have create
On Wed, 30 May 2001, David Gilden wrote:
> The following seems to never break out of the loop,
> any comments?
> Thanks
>
> Dave
>
> #!/usr/bin/perl -w
>
>
> $data = 'some
> multi line
> string';
>
>
> while($data){
>
>push(@everyline, $_);
>
> }
Yes, it's going to loop infinitel
OOps, hit send too soon...
This is _not_ the same as reading from a filehandle!
while () is NOT the same as while($variable) {unless $variable is a
filehandle}
If working with a filehandle, the while will loop until no data is left.
With a string, it will just keep looping while true (data i
Because the while loop will loop for as long as $data is "true" or contains
data Considering that it has data in it, you have created an
"infinite" loop
David Gilden
On Wed, May 30, 2001 at 01:25:07PM -0400, David Gilden wrote:
> The following seems to never break out of the loop,
> any comments?
> Thanks
>
> Dave
>
> #!/usr/bin/perl -w
>
>
> $data = 'some
> multi line
> string';
>
>
> while($data){
>
>push(@everyline, $_);
>