in reply to not getting desired output

I see a number of things that could be improved here. Ikegami listed more below and quite correctly so.
For now, I'll just address the first part of "how to start".

The first thing is to determine whether or not we have the right number of arguments. In Perl this the number of elements in @ARGV.

Then normally statement(s) follow that assign the @ARGV elements to $scalar values.

Then these values are used. Update: to open file(s)

This is a general "formula or pattern" for your Perl programs.

#!/usr/bin/perl -w use strict; #my $logFile = $ARGV[0]; #die "usage: $0 <logFile>" unless $logFile; #die "Logfile $logFile doesn't exist" unless -f "$logFile"; #open(my $log, "<", $logFile) or die "Can't open $logFile for reading. +" die "Wrong number of args\nUsage: $0 Logfile" if (@ARGV != 1); my ($logFile) = @ARGV; open(my $log, "<", $logFile) || die "Can't open $logFile for reading";