Skip to content

Instantly share code, notes, and snippets.

@swuecho
Created July 9, 2012 18:14
Show Gist options
  • Select an option

  • Save swuecho/3077991 to your computer and use it in GitHub Desktop.

Select an option

Save swuecho/3077991 to your computer and use it in GitHub Desktop.
variables in perl
use Modern::Perl;
# my (a, b, c) = 1, 2, 3
my $a=2;
my $b=3;
my $c=4;
say ($a, $b, $c);
sub test {
# my $c=0;
say $a; #2
say $b; #3
say $c; #4
$c+=1;
say $c; #5
}
test();
say ($a, $b, $c); # 235
=comment
for varibles in perl, in if you can see it your can edit it. you can not see the
varible outside.
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment