Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Single and Double Quotes in Perl
You can use double quotes or single quotes around literal strings as follows −
Example
#!/usr/bin/perl print "Hello, world\n"; print 'Hello, world\n';
Output
This will produce the following result −
Hello, world Hello, world\n$
There is an important difference between single and double-quotes. Only double quotes interpolate variables and special characters such as newlines \n, whereas a single quote does not interpolate any variable or special character. Check below example where we are using $a as a variable to store a value and later printing that value −
Example
#!/usr/bin/perl $a = 10; print "Value of a = $a\n"; print 'Value of a = $a\n';
Output
This will produce the following result −
Value of a = 10 Value of a = $a\n$
Advertisements
