Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Riyali-101738
#perl 5.22.1 package Virus; sub new{ print "Created Virus\n"; $class = "Virus"; $self = {}; bless $self,$class; } sub infect{ print "Infected by Virus\n" } $virus = new Virus(); print "Reference to : ",ref($virus),"\n"; $virus->infect(); print "\n\n\n"; package Virus; sub new{ print "Created Virus\n"; $class = "Virus"; $self = {}; bless $self,$class; } sub infect{ print "Infected by Virus\n" } $virus = new Virus(); print "Reference to : ",ref($virus),"\n"; $virus->infect(); print "\n\n\n"; package Worm; sub infect{ print "Infected by Worm\n" } $virus = new Virus(); print "Reference to : ",ref($virus),"\n"; $virus->infect(); print "\n\n\n"; package Virus; sub infect{ print "Infected by Virus\n" } infect(); package Worm; sub infect{ print "Infected by Worm\n" } infect(); print "\n\n\n"; sub funny{ print "Arguments are : @_\n"; $x = shift; print "Argument is : $x\n"; $x = shift; print "Argument is : $x\n"; $x = shift; print "Argument is : $x\n"; print "Argument 1 is : @_[1]\n"; } funny(1,3,5,"apple","little star"); print "\n\n\n"; @jack = qw/jack and jill went up the hill/; @twinkle = qw/twinkle twinkle little star/; print "@jack\n"; print "@twinkle\n"; @rhymes = (@jack,@twinkle); print "@rhymes\n"; print "\n\n\n"; @sea = qw/She sells sea shells on the sea shore/; @core = (3,2,5,6,7,5,4,3,6,8,7,6); print "Before : @sea\n"; print "Before : @core\n"; @sea = sort(@sea); @core = sort(@core); print "-+-+-+-+-+-+-+-+-+-+-+\n"; print "After : @sea\n"; print "After : @core\n"; print " \n\n"; @questions = qw/Them that ask no question never told a lie/; @odds = qw/May the odds be with you/; $qstring = join(' * ',@questions); $oddstring = join(',',@odds); print $qstring."\n"; print $oddstring."\n"; print " \n\n"; $rats = "Rats live on no evil star"; $fox = "A:quick:brown:fox:jumps:over:the:lazy:dog"; @star = split(' ', $rats); @foxy = split(':', $fox); print "$star[4]\n"; print "$foxy[3]\n"; print " \n\n"; @nums = (1..20); print "Before - @nums\n"; splice(@nums, 5, 6, 20..22); print "After - @nums\n"; @circus = qw/Tinker Tailor Soldier Spy/; print "$circus[1] is the mole.\n\n"; print "$circus[3] is the mole.\n\n"; print "$circus[-2] is the mole.\n\n"; $a=5; print ' Single $a\n '; print " Double $a "; print "\n\n\n"; @jokers = ("Harry" , "ron" , "Hermione"); @cartoons = ("chulbul " , "phunsuk wangdo" , "pa Dunga"); print "\$jokers[1]=$jokers[1]\n"; print "\$cartoons[2]=$cartoons[2]\n"; print "\n\n\n"; %data = ('hunt' , 2100 , 'benji' , 54 , 'faust' , 13); print "\$data{'hunt'} = $data{'hunt'}\n"; print "\$data{'benji'} = $data{'benji'}\n"; print "\$data{'faust'} = $data{'faust'}\n"; print "\n\n\n"; $mission = "fast"; $impossible = "furious"; $str = $mission." and ".$impossible; $num = 5 + 3; $mul = 4 * 5; $mix = $str ." ". $num; print "str = $str\n"; print "num = $num\n"; print "mul = $mul\n"; print "mix = $mix\n"; print "\n\n"; @circus = qw/Tinker Tailor Soldier Spy/; print "1. \@circus = @circus\n"; push(@circus, "Moneypenny"); print "2. \@circus = @circus\n"; unshift(@circus, "Ilsa Faust"); print "3. \@circus = @circus\n"; pop(@circus); print "4. \@circus = @circus\n"; shift(@circus); print "5. \@circus = @circus\n";
run
|
edit
|
history
|
help
0
perl plot circular list in a circle
Attractive Numbers
Sea
Perl
101744
101772
Tony Gunk
Challenge 41 Task 1
Lol
Reference