Try
sub print_line {
my $source = shift;
my $port = shift;
my $ip = shift;
format TABLE_FORMAT =
Name of Video Source: @<<<<<<<<<<<<<<<
$source
Local Port Number: @<<<<<<<<<<<<<<<
$port
Destination IP address: @<<<<<<<<<<<<<<<
$ip
.
$~ = 'TABLE_FORMAT';
write;
}
while (<>) {
chomp;
print_line($_, 'example', 'example');
}