# author: Your name
# created on:
# description: solution for assignment no.
# read command line option -file
# open your text input file
# read each line inside your file
# and: replace string "NP" by string "nominal phrase"
# or: check for string "ACGT"
# open your text output file
# write your changed or found lines to your output file
# close your text output file
# close your text input file
####
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
####
$temp_fahrenheit_1 = 32 + $temp_c_1 * 1.8;
$temp_fahrenheit_2 = 32 + $temp_c_2 * 1.8;
...
####
sub c_to_fahrenheit {
my $temp_in_c = shift @_;
my $temp_in_f = 32 + $temp_in_c + 1.8;
return($temp_in_f);
}
$temp_fahrenheit_1 = c_to_fahrenheit($temp_c_1);
####
@temperatures_in_c = (5,10,15,20);
@temp_in_f = map(c_to_fahrenheit($_),@temp_in_c);
####
do something(\@myarray,\%myhash,\$mystring);
sub do_something {
my @localarray = @{shift @_};
my %localhash = %{shift @_};
my $localstring = ${shift @_};
...
}
####
%course = (code => $code;
weekday => $day,
time => $time,
title => $title,
location => location);
####
$date{weekday} = $day;
$date{time} = $time;
$course{"date"} = %date;
...
####
$testphrase = "The colours of the rainbow are red, yellow, green, blue, indigo, and violet";
($newphrase = $oldphrase) =~s/colour/color/;