in reply to Re^4: perl regular expressions
in thread perl regular expressions

You're welcome!

Yes, there is a way to combine them into one. Add a use Data::Undump, and then change the the part between say Dumper($hash) and $data = <> so that you're not printing to STDOUT and reading from STDIN anymore:

#!usr/bin/perl use feature qw/say/; use Data::Dumper; use Data::Undump; $Data::Dumper::Terse = 1; $hash = { 'testing' => { 'link' => "http://www.espn.com", 'bandwidth' => "100", 'r' => "2", }, }; $data = Dumper($hash); $undump = undump($data); die "'testing' not found!" unless($undump->{'testing'}); say $undump->{'testing'}->{'link'} // (die "'link' not found!"); say $undump->{'testing'}->{'bandwidth'} // (die "'bandwidth not found! +");

But of course now you're dumping and undumping your data in the same script, which is basically a no-op. So you could further simplify this to the following:

#!usr/bin/perl use feature qw/say/; $hash = { 'testing' => { 'link' => "http://www.espn.com", 'bandwidth' => "100", 'r' => "2", }, }; die "'testing' not found!" unless($hash->{'testing'}); say $hash->{'testing'}->{'link'} // (die "'link' not found!"); say $hash->{'testing'}->{'bandwidth'} // (die "'bandwidth not found!") +;

But that's got little to do with you original question anymore.