#!/usr/bin/perl -w $file=$ARGV[0]; @params=; %numberoftimes={}; $nuoftimes=0; while(){ @lines=split("\n",$file); for $line(@lines){ for $p(@params){ if (index($line,$p)){ nuoftimes++; #create a new file } $%numberoftimes{$p}=$nuoftimes; #every time $p is found in $line, #i have to write that $line in the new file elsif($p eq "end") #the input of the parameters should end } } }