#!/usr/bin/perl

my $string = "TIMTOWTDI!";


# String Functions

chop($string); # Removes the last character from the string

chomp $string; # Removes only new lines from the string based on what #/ is for your system

$string = lc($string); # assigns 



# Numeric Functions

cos, sin, tan, exp, log, rand, sqrt;



# Array specific functions

my @array      = qw(one two three four);
my $next_value = 'five';

push @array, $next_value; # Puts a scalar on the end of your array

pop @array; # pulls the scalar off the end of the array and returns it

unshift @array, 1; # Puts a scalar on the beginning of the array

shift @array; # Pulls a scalar off the beginning of the array and returns it.


# Arrays and Strings

my @months = ( 1 .. 12 );

my $string = join( ', ', @months );    # 1, 2, 3, 4, 5, 6 ...

my $delimited_list = 'name~age~gender~location';

my @info = split( /~/, $delimited_list );



# Hash Functions

my %month = (
    'Jan' => 1,
    'Feb' => 2,
    'Mar' => 3,
    'Apr' => 4,
    'May' => 5,
    'Jun' => 6,
    'Jul' => 7,
    'Aug' => 8,
    'Sep' => 9,
    'Oct' => 10,
    'Nov' => 11,
    'Dec' => 12
    );

delete $month{Dec}; # removes key/value pair

if ( exists $month{June} ) {
    print "It's June!"; 
}

my @month_abbr = keys %month;

my @month_nums = values %month;


# File Operators

open(my $file, '<', 'in.dat');

my $line = <$file>; # read a line at a time

my @lines = <$file>; # all lines assigned to an array

close($file) or die "how do I get here?";

Will forgot to talk about grep. tell him to fix this document!