Skip to content

Commit

Permalink
Create call_by_reference.pl (#737)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
namhsuya authored and t2013anurag committed Oct 20, 2017
1 parent 4c6d443 commit e9e955b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions call_by_reference/perl/call_by_reference.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/perl -w

my $num1 = 100;
my $num2 = 5;

sub swap{
$temp = $_[0];
$_[0] = $_[1];
$_[1] = $temp;
return;
}

print "Value of num1 BEFORE swap $num1\n";
print "Value of num2 BEFORE swap $num2\n\n";

swap($num1, $num2);

print "Value of num1 AFTER swap $num1\n";
print "Value of num2 AFTER swap $num2";

0 comments on commit e9e955b

Please sign in to comment.