Is there an easy way, using a subroutine maybe, to print a string in Perl without escaping every special character?
This is what I want to do:
print
You can pretty much use any character you want with q
or qq
. For example:
#!/usr/bin/perl
use utf8;
use strict; use warnings;
print q∞This is a test∞;
print qq☼\nThis is another test\n☼;
print q»But, what is the point?»;
print qq\nYou are just making life hard on yourself!\n;
print qq¿That last one is tricky\n¿;
You cannot use qq DELIMITER foo DELIMITER
. However, you could use heredocs for a similar effect:
print <
or
print <<'DELIMETER'
...
DELIMETER
;
but your source code would be really ugly.