Syntax error Escaping Characters in Perl

Escaping Characters in Perl



Perl uses the backslash (\) character to escape any type of character that might interfere with our code. Let's take one example where we want to print double quote and $ sign −

Example

 Live Demo

#!/usr/bin/perl
$result = "This is \"number\"";
print "$result\n";
print "\$result\n";

Output

This will produce the following result −

This is "number"
$result
Updated on: 2019-11-28T07:47:17+05:30

618 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements