Help for this page
open($FH,'<','file.txt'); $arr[$i]=join('',(<$FH>)); ... if (substr($arr[i],-1,1) eq '-') { $arr[i]=~ s/-$//g; # I assume you meant, though you've already done + it above }