Repositories (1)

perl
18 snippets stored for this repo
Perl IconPerl
# note, can combine all of thes / operators to use all their options, like /six = /i /s / /x
# /i = for case insentive example
print "Tell me yes bitch:\n";
chomp ($answer = <STDIN>);
if (/yes/i) {	# Same as saying /yes/ and /YES/ with just /i
  print "So you like answering yes don't you?\n";
Perl IconPerl
if ($num <= 30) {		#running an if command for numbers bigger than 30
  $stuff = $word x $num;	#doing the multiple of print.
  print $stuff, "\n";		#the actual printing of the value $stuff.
} else {		#will not print more than 30.
  print "Bitch, i'm not printing $word, $num amount of times\n";
}
print "Enter some lines, then press Ctrl+D:\n";               # type some shit, press enter, repeat till whenever, press Ctrl+D (if windows Ctrl+Z), ??????, PROFIT!
    @lines = <STDIN>;                                                                           #whatever your type is stored here till you press ctrl+D (or Ctrl+Z)
    print "\n\nLets reverse this bitch \n *~~~~~~~~~~~~~~~~~~~~~~~~~~*\n"; #im making a mess lol but it looks ok :P
    print reverse @lines;                                                                     #prints @lines in reverse order 
    print " *~~~~~~~~~~~~~~~~~~~~~~~~~~*\n";			#~*~*~*~*D3c0rat!0nz*~*~*~*~
Perl IconPerl
if ($age < 10) {	#a double if loop. Note that on each if, there is a classifier for the data range.
  print "\nOh so you are less then fucken 10 and can do fucken shit like this.... jackass\n";
  $a1 = $age;
Perl IconPerl
} else {
    print "You are too old to be doing this type of shit,";
  }
Perl IconPerl
# UUSe 11.1 for reference!
$open(CONFIG, ">", "test.txt");

die "Shit hit the fan! File exist!"
	if -e CONFIG; #one line remember :)

warn "Config is old man!\n" #giving a warning, but still continuing the command.
#!/usr/bin/perl -w
#chapter 3 exercise 2 ಠ_ಠ
@onamae = qw/ slut crack cocaine guns magnum light deadly /;
print "Enter some numbers from 1 to 7, one per line, then press Ctrl-D:\n";
chomp(@numbers = <STDIN>);
foreach (@numbers) {
	print "$onamae[ $_ - 1 ]\n";
Perl IconPerl
if (defined($give)) {
  print $give;
} else {
  print "Either you were a dick and gave the number 20 or you gave something higher -_-\n";
}
Press 2 to continue freaking out\n\n";
chomp ($question = <STDIN>);
if ($question == 1) {
print "The Gazoo is forever nigga, now listen this is a game that martin made up to test your skills to make your way out of here. Now listen you will do some things and you will make it home in no time.";
}
elsif ($question ==2) {
print "\n Shut the fuck up, now listen this is a game that martin made up to test your skills to make your way out of here. Now listen you will do some things and you will make it home in no time.";
#!/usr/bin/perl -w

    $pie = 3.141592654; 				#cause I said so :P ; pie variable = pi = 3.141592654
    print "TYPE A FUCKING RADIUS ";  #Asks the user to type a fucking radius so pick a number
    chomp($radius = <STDIN>);               #stores the number that the program scared the user into typing 
    $circum = 2 * $pie * $radius;			#circum = circumfrence; computes the circumfrence of a circle with a radius of 12.5
    print "Circumference of a circle with a radius $radius is $circum.\n"; 		#prints the answer
#!/usr/bin/perl  -w

    $pie = 3.141592654; 				#cause I said so :P ; pie variable = pi = 3.141592654
    print "TYPE A FUCKING RADIUS ";  #Asks the user to type a fucking radius so pick a number
    chomp($radius = <STDIN>);               #stores the number that the program scared the user into typing 
    $circum = 2 * $pie * $radius;			#circum = circumfrence; computes the circumfrence of a circle with a radius of 12.5
	if ($radius < 0)		{			#If statement had the number was below 0
@value = values %superhash; #holds 1, 2, 3

if (%hash) {	#boolean or a true and false statement. Vey good trick to do debugging.
  print "True value motherfucker!\n";
}

while ( ($key, $value) = each %superhash) { #each command only works in a while loop. Each element taking the value and the key.
Perl IconPerl
$old = -M $last;

	unless (-e $name) {
		die "You gave no file faggot -_-\n";
	} else {
		my $age = -M $name;
		if ($age > $last) {
Perl IconPerl
#w,x,r, doesn't exist
foreach $name(@ARGV) {		#remember @ARGV checks for cli input
	die "Doesn't exist faggot!\n" 
		unless -e $name;	#one liners here trying to make sure that the file exist.

	#here is the actual call for the commands. notice how each one is separate to allow to be added in.
Perl IconPerl
sub type {
	my $move = shift @_; #moving the file into a scalar called move
	return "wrong cause you gave no file faggot!\n" unless -e $move; #stop the subroutine if the file doesn't exist

	my @type; #getting the format of type in a list. 
	push @type, "readable" if -r $move;
Perl IconPerl
while (chomp ($input = <STDIN>)) {
	$random = int(1+ rand 100);		#using this command to get random value iterator.
	unless ($input == $random ) {	#Here is the loop of magic :)
		print "Try again faggot\n";
	} elsif ($input < $random) {
		print "Go higher!\n";
	} elsif ($input > $random) {
sub like {
  if (@_ != 2) { #simple make sure that the subroutine has an error checker. Note this is RARELY used.
    print "FUCKER, this shit ain't wooooorking AAAAARGH!\n";
  }
}
Perl IconPerl
# Exercise 1 and the only exercise in 10.10


print "I want you to guess a number from 1-100. Any number fucker :)\n";

$everything = 42;