develooper Front page | perl.perl5.porters | Postings from December 2016

Why does the debugger use single quotes when dumping strings?

Thread Next
From:
Sam Kington
Date:
December 3, 2016 14:46
Subject:
Why does the debugger use single quotes when dumping strings?
Message ID:
DD3F2D57-4D10-43FE-9A51-B7A1BCAF17E7@illuminated.co.uk
Hi,

This is curiosity rather than anything else, but: why is the debugger using single quotes here?

Deceptive:Hacks sam$ perl -d unicode.pl 

Loading DB routines from perl5db.pl version 1.33
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

DB::DB(unicode.pl:7):	my $pile_of_poo = "\N{PILE OF POO}";
  DB<1> n                                                                       
DB::DB(unicode.pl:8):	say Encode::encode('UTF8', $pile_of_poo);
  DB<1> x $pile_of_poo                                                          
0  '\x{1F4A9}’

If it’s going to report a string that uses interpolation, shouldn’t it be using double quotes? Is there a historical reason for this, or was it just something that didn’t matter until you could expect \x escapes in strings, so people just chose single quotes because why not?

Sam
-- 
Website: http://www.illuminated.co.uk/


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About