print_r()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    print_r()

    Many PHP function replicate Perl functions, but what about the other way
    around. Is there anything for Perl that does what the print_r()
    function does in PHP?

    Mark
  • Benjamin

    #2
    Re: print_r()


    Mark wrote:
    Many PHP function replicate Perl functions, but what about the other way
    around. Is there anything for Perl that does what the print_r()
    function does in PHP?
    I would ask this in a Perl group.
    >
    Mark

    Comment

    • larry@portcommodore.com

      #3
      Re: print_r()


      Mark wrote:
      Many PHP function replicate Perl functions, but what about the other way
      around. Is there anything for Perl that does what the print_r()
      function does in PHP?
      >
      Mark
      Google for:

      print_r() perl

      and you get some leads.

      Comment

      • Petr Vileta

        #4
        Re: print_r()

        "Mark" <Mark.Fenbers@n oaa.govpíse v diskusním príspevku
        news:ek9po1$hok $2@news.nems.no aa.gov...
        Many PHP function replicate Perl functions, but what about the other way
        around. Is there anything for Perl that does what the print_r() function
        does in PHP?
        >
        No, this function have no equivalent in Perl.
        --

        Petr Vileta, Czech republic
        (My server rejects all messages from Yahoo and Hotmail. Send me your mail
        from another non-spammer site please.)


        Comment

        • dyer85

          #5
          Re: print_r()

          Check out the Data::Dumper module. You can use it in a procedural
          fashion as well as object-oriented.

          On Nov 25, 8:07 am, Mark <Mark.Fenb...@n oaa.govwrote:
          Many PHP function replicate Perl functions, but what about the other way
          around. Is there anything for Perl that does what the print_r()
          function does in PHP?
          >
          Mark

          Comment

          • Petr Vileta

            #6
            Re: print_r()

            <larry@portcomm odore.compíse v diskusním príspevku
            news:1164517087 .592391.20950@l 39g2000cwd.goog legroups.com...
            >
            Mark wrote:
            >Many PHP function replicate Perl functions, but what about the other way
            >around. Is there anything for Perl that does what the print_r()
            >function does in PHP?
            >>
            >Mark
            >
            Google for:
            >
            print_r() perl
            >
            and you get some leads.
            >
            Of course, Data::Dumper but this is a module not Perl function. Module is
            similar to PHP class ;-)
            --

            Petr Vileta, Czech republic
            (My server rejects all messages from Yahoo and Hotmail. Send me your mail
            from another non-spammer site please.)


            Comment

            • Curtis

              #7
              Re: print_r()

              If you perldoc Data::Dumper, you'll see that you can use its procedural
              interface, thanks to perl's use of namespaces:

              Quoted from perldoc:
              use Data::Dumper;

              # simple procedural interface
              print Dumper($foo, $bar);

              As you can see, the module has a procedural interface. I noticed the
              author of this thread started the same one in comp.lang.perl. modules,
              if anyone's interested.

              Also, note that if you want to dump an array or hash with the
              Data::Dumper module, you need to pass it as a reference:

              my %hash = ('a'=>'foo', 'b'=>'bar', 'c'=>'baz');
              print Dumper(\%hash);

              Curtis

              Petr Vileta wrote:
              <larry@portcomm odore.compíse v diskusním príspevku
              news:1164517087 .592391.20950@l 39g2000cwd.goog legroups.com...

              Mark wrote:
              Many PHP function replicate Perl functions, but what about the other way
              around. Is there anything for Perl that does what the print_r()
              function does in PHP?
              >
              Mark
              Google for:

              print_r() perl

              and you get some leads.
              Of course, Data::Dumper but this is a module not Perl function. Module is
              similar to PHP class ;-)
              --
              >
              Petr Vileta, Czech republic
              (My server rejects all messages from Yahoo and Hotmail. Send me your mail
              from another non-spammer site please.)

              Comment

              • Curtis

                #8
                Re: print_r()

                Of course, Data::Dumper but this is a module not Perl function. Module is
                similar to PHP class ;-)
                Sorry, I just realized I didn't address your comment correctly. Doh!
                Yes, you're right, it's a module, but like C or Java, most of Perl's
                usefulness comes from the pre-built APIs. I do not believe there is any
                native Perl functions that are even similar to print_r. If there were,
                there probably wouldn't be a data dump module. ;-)

                Comment

                Working...