Skip to content

Commit e9e955b

Browse files
namhsuyat2013anurag
authored andcommitted
Create call_by_reference.pl (#737)
* Add is_palindrome.pl Added Perl-script to find if a string is palindromic or not. * delete is_palindrome.pl adding subfolder * add perl folder, create is_palindrome.pl Perl-script for checking palindrome * Create call_by_reference.pl Added perl-script to show calling by reference in perl
1 parent 4c6d443 commit e9e955b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/perl -w
2+
3+
my $num1 = 100;
4+
my $num2 = 5;
5+
6+
sub swap{
7+
$temp = $_[0];
8+
$_[0] = $_[1];
9+
$_[1] = $temp;
10+
return;
11+
}
12+
13+
print "Value of num1 BEFORE swap $num1\n";
14+
print "Value of num2 BEFORE swap $num2\n\n";
15+
16+
swap($num1, $num2);
17+
18+
print "Value of num1 AFTER swap $num1\n";
19+
print "Value of num2 AFTER swap $num2";

0 commit comments

Comments
 (0)