http://www.perlmonks.org?node_id=208391


in reply to Re: Matching over multiple lines in a scalar
in thread Matching over multiple lines in a scalar

Thanks for the help on this. By the way - just out of curiosity - why pass a hash reference to Data::Dumper instead of just the hash?


«Rich36»
  • Comment on Re: Re: Matching over multiple lines in a scalar

Replies are listed 'Best First'.
Re: Re: Re: Matching over multiple lines in a scalar
by BrowserUk (Pope) on Oct 27, 2002 at 22:51 UTC

    If you pass the hash, it gets flattened and passed as a list of 30 seperate scalars, the association between key=>value pairs is lost. By passing the reference, Data::Dumper knows it a hash, and outputs it as such, with the Key=>value pairs clearly associated and shown as being a part of a compound entity.

    In fact, you can then write this output to a file and then read it back, eval the string and it will recontruct the hash in memory. Often used as a cheap man DB.

    Run the program both ways to see the difference.


    Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy