newbie question

newbie question

am 12.10.2007 02:48:25 von andrew_nuss

Hi,

How do you apply a regexp directly to a stream rather than a string?

Andy

Re: newbie question

am 12.10.2007 03:14:20 von sln

On Thu, 11 Oct 2007 17:48:25 -0700, andrew_nuss@yahoo.com wrote:

>Hi,
>
>How do you apply a regexp directly to a stream rather than a string?
>
>Andy

But, what is a stream? All I/O is buffered to variables, otherwise
languages wouldn't exist, there would be no need, there would only be
a before and after. No middle. Quantum middleware.

An infinite loop @the_universe = /+$regexp/g;

Re: newbie question

am 12.10.2007 04:41:17 von Paul Lalli

On Oct 11, 8:48 pm, andrew_n...@yahoo.com wrote:

> How do you apply a regexp directly to a stream rather than a
> string?

Explain what you mean by "stream" in this case.

As a pure hunch, maybe you want the File::Stream module from CPAN,
which allows you to read from an open file handle delimited by a
regexp rather than a string.

Paul Lalli

Re: newbie question

am 12.10.2007 22:38:02 von RedGrittyBrick

andrew_nuss@yahoo.com wrote:
>
> How do you apply a regexp directly to a stream rather than a string?
>

This looks to me like the sort of post where the OP never replies to
comments (perhaps never reads them).

As others have pointed out, your question is too vague to answer
properly, but I wondered if you meant something like

C:\> dir | perl -ne "print if m!0[123]/2007!"

where the string is implicit rather than explicit and the "stream"
refers to what some might call a piped input stream STDIN.

http://en.wikipedia.org/wiki/Standard_streams
http://en.wikipedia.org/wiki/Stream_%28computer%29
http://en.wikipedia.org/wiki/Streams_%28networking_API%29