my $string = "TIMTOWTDI!";
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
cos, sin, tan, exp, log, rand, sqrt;
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.
my @months = ( 1 .. 12 );
my $string = join( ', ', @months );
my $delimited_list = 'name~age~gender~location';
my @info = split( /~/, $delimited_list );
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};
if ( exists $month{June} ) {
print "It's June!";
}
my @month_abbr = keys %month;
my @month_nums = values %month;
open(my $file, '<', 'in.dat');
my $line = <$file>;
my @lines = <$file>;
close($file) or die "how do I get here?";
Will forgot to talk about grep. tell him to fix this document!