Equivalent of Perl's $\ ????

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Is there an equivalent to Perl's output record separator, or input
record separator for that amtter, ( $\ and $/ ), in PHP?


Re: Equivalent of Perl's $\ ????

*** fourfour2@gmail.com wrote/escribió (3 Aug 2005 00:38:31 -0700):
Quoted text here. Click to load it

I know nothing about Perl. What's this operator supposed to do?

-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group

Re: Equivalent of Perl's $\ ????

It's a special variable that is used when you read data in from a Perl
file. It reads in chunks of data based on a delimiter.
The default is\n.

F.ex. if you know an input file has 3 new lines between paragraphs, yiu
can set $/ = "\n\n\n";

So insted of reading in line for line, you get the whole parachraphs as

Of course the 3 new lines could instead be any pattern you want to use
as a delimiter.


Re: Equivalent of Perl's $\ ????

If you want to split somthing into array try
$record_array = preg_split("\#\","record1#record2#record3");

Re: Equivalent of Perl's $\ ????

On 3 Aug 2005 02:16:53 -0700, Sergej Andrejev wrote:
Quoted text here. Click to load it

Use explode() for simple record boundaries like this; it uses far less
resources (time, memory) than a call to the (p)regex lib.

Firefox Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/

OT - Google Groups

Quoted text here. Click to load it

Some usenauts have reportedly judged G2 users non compos  
mentis enough to killfile them unread.  Insufficient grounds  
for sentencing, you might protest.  Myself, not yet having  
read what they've written, I'd return the verdict not proven.  
It's just possible - sometimes - to have your posts appear  
normal using Google Groups.  It just takes a bit of doing.


Site Timeline