Equivalent of Perl's $\ ????

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fourfour2@gmail.com

    Equivalent of Perl's $\ ????

    Hi,

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

    Thanks,
    Ed

  • Alvaro G Vicario

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

    *** fourfour2@gmail .com wrote/escribió (3 Aug 2005 00:38:31 -0700):[color=blue]
    > Is there an equivalent to Perl's output record separator, or input
    > record separator for that amtter, ( $\ and $/ ), in PHP?[/color]

    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
    --

    Comment

    • Sergej Andrejev

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

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

      Comment

      • Ewoud Dronkert

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

        On 3 Aug 2005 02:16:53 -0700, Sergej Andrejev wrote:[color=blue]
        > If you want to split somthing into array try
        > $record_array = preg_split("\#\ ","record1#reco rd2#record3");[/color]

        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/

        Comment

        • John Dunlop

          #5
          OT - Google Groups

          > User-Agent: G2/0.2

          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.

          --
          Jock

          Comment

          • fourfour2@gmail.com

            #6
            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
            chunks.


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


            Ed.

            Comment

            Working...