Perl concatenate an array

Not a perl guru and need some help with a script I inherited. My perl script has a variable that is concatenated and works fine as is, but what I need is to remove a string in the output and input a files content. This is emailed as a html report and I can't get the file to output in the email message. I can get it to print to stdout, but that is all.

Present line:

$output .= "<FONT style='background:green;color:white;'>$router_routes</FONT><br><br>";

Replacement:

open(router_CHECK, "< /usr/local/home/router/router.check");
@datacheck = <router_CHECK>;
close(router_CHECK);
 
$output .= @datacheck;

File content example trying to load:

<p style="line-height: 100%; margin-top: 0; margin-bottom: 0">
ROUTER1#show run | inc 192.168.1.0
ip route 192.168.1.0 255.255.255.0 10.1.1.1
</p>
<p style="line-height: 100%; margin-top: 0; margin-bottom: 0">
ROUTER2#show run | inc 192.168.2.0
ip route 192.168.2.0 255.255.255.0 10.1.2.1
</p>

Any suggestions?

Hi,

I don't understand what you want. The '$output' variable has the content of the file, what doesn't work?

Regards,
Birei

In the email everything except the array is printed. All I get a the number 1 for what is suppose to be printed from the array. I just don't understand why it's not working.

Hi,

Try:

open(router_CHECK, "< /usr/local/home/router/router.check") || die "Cannot open file: $!\n"; 
@datacheck = <router_CHECK>; 
close(router_CHECK);   
$output .= "@datacheck";

Regards,
Birei

You concatenate the array with the scalar variable so in a scalar context. In a scalar context when you use an array you get a number of elements in this array not its elements.