it's a good idea to open a file for read only, if you only ever intend to only read the file, otherwise it gets opened automatically read+write.
can't test your code at moment but generally when constructing funky strings, especially that $fk is input to a module/function, i'd recommend forming it like so
my $fk = "$ff" . ':255.255.255.0';
to make sure perl doesn't think that $ff: (for instance) is an entry into the symbol table instead of what you intend.
so i always double quote variables separately, and attach other bits of strings in single quotes.
the hardest line to type correctly is: stty erase ^H