Second Perl Scripting – Making Subroutine

#!/usr/bin/perl
use utf8;
use strict;
use warnings; 
#the simplest subroutine form.
sub subroutine
{
	print ("made a subroutine.","\n");
}
#call the subroutine.
subroutine();

#make procedures to output all text of the input file.
#next make these procedures to one subroutine.
#define input text's path.
my $inputtxt="/home/ComputerProgramming_Home/PERL/hi.pl";
#construct file handler $in using open() function.
open(our $in,"<",$inputtxt);#our keyword means global variable
#use <> symbol.
#this means null file handle.
#<$in> means make file handler using $in file path which is opened by open() above.
our $line=<$in>;

#debris code of previous test code.
#print ($line);
#$line=<$in>;
#print ($line);
#for(my $i=0;$i<10;$i++)

#finally, will use eof(End Of File) function of perl.
#this returns 1, if reached to the end of the file.
while(eof($in)!=1)
{
	$line=<$in>;
	print ($line);
}
print ("file end...");

First Perl Scripting

#!/usr/bin/env perl
use utf8;
use strict;
use warnings; 
#don't forget to add newline as "\n". type1. just add \n.
print ("hey...\n");
#strict mode of perl needs declaration using my keyword.
#don't forget semicolons of end of the statements.
my $var=1;
#don't forget to add newline as "\n". type2. use semicolon and "\n".
print ($var,"\n");
#array declaration. qw means for quotation words?
#it's same to ("lun","mar","mer")
my @arr=qw(lun mar mer);
print (@arr[1],"\n");

my @arr2=qw(1 2 3);
print (@arr2[1],"\n");

print (@arr2[1]+@arr2[2],"\n");