in reply to Re: sprintf is printing unexepected output
in thread sprintf is printing unexepected output

You may also give a try with Data::Dump, which can emit a nice output in the form of a quoted Perl string with less fuss.

use Data::Dump qw(dump); chomp($code = <IFH>); print dump($code);

Data::Dumper has the advantage of being in the core, but Data::Dump usually install smoothly from CPAN.

Replies are listed 'Best First'.
Re^3: sprintf is printing unexepected output
by demerphq (Chancellor) on Dec 30, 2006 at 10:51 UTC

    You want to be careful about Data::Dump, its actually one of the worst serilization modules around. Its relatively trivial to construct a structure that will make Data::Dump extremely unhappy.

    Stick with Data::Dumper, and if you need something easier to read and more powerful and accurate then switch to Data::Dump::Streamer.

    ---
    $world=~s/war/peace/g

      I really didn't know that. In my experiences (which are far from sophisticated), I don't remember a single time I regreted to use Data::Dump. Probably I haven't reached the edges that you mentioned. Given the zero size of the bug queue of the module and the general quality of modules by Gisle Aas, I thought it was quite a robust module. Maybe such examples of intolerance by Data:Dump should be transformed into bugs, so they get a chance of being fixed.

      But it may be possible as well that things changed since the last time you gave a chance to Data::Dump. For instance, in the Changes file, we read:

         Release 1.05
      
         Improved track scalar references; dump() ended up
         recursing forever on some cyclic structures.
      

      On the other hand, the usage we were telling about was as a debugging aid. If it fails, you can backup to Data::Dumper's ugly output without serious consequences.

        Ugly output? What do you mean?