perl -e 'use strict;use warnings;$a=2;print $a'
It seems no warning is reported when I declare a global variable without our,so when is this keyword necessary?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$aand$bare special cases – they are reserved forsort(e.g.sort { $a <=> $b }) and shouldn’t be used for your own variable names – try again using something else and see what happens!