Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] How to traverse through a array reference

Expand Messages
  • Jenda Krynicky
    From: saurabh talwar ... use Data::Dumper; print Dumper($p4_info); Once you know what s inside the $p4_info you can acces the
    Message 1 of 3 , Jan 6, 2009
      From: "saurabh talwar" <talwar.saurabh@...>
      > I am having problems going through the hash reference and outputting the
      > result.
      >
      > Can someone tell me how to traverse thorugh the output of "p4 info" using
      > Perl.
      > p4 info is a command in perforce.
      >
      > Is there any way I can increment an address and look what is stored inside
      > till I hit EOF just like C . The reason is that this array could be an array
      > of hashes or array of arrays or any mixed combination.
      >
      > Any help is greatly appreciated ?
      >
      > sub run_info()
      > {
      > my $key;
      > my $value;
      > my $p4_info;
      > my $val;
      > $p4_info = $p4->Run( "info" );
      >
      > ## p4_info is a reference to an array but I dont know what is inside that
      > array.
      > ## p4_info is ARRAY(0x226f8c)

      use Data::Dumper;

      print Dumper($p4_info);

      Once you know what's inside the $p4_info you can acces the bits.

      Jenda
      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    Your message has been successfully submitted and would be delivered to recipients shortly.