#! /usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = new Spreadsheet::WriteExcel('hallo.xls'); die "Problems creating new Excel file: $!" unless defined $workbook; my $sheet = $workbook -> add_worksheet(); my $green = $workbook -> add_format( bg_color => 'green' ); my $blue = $workbook -> add_format( bg_color => 'blue' ); my $red = $workbook -> add_format( bg_color => 'red' ); my $cell = 0; for( 100, 10, 5, 30 ){ my $format = $green; if( $_ < 10 ){ $format = $red; } elsif( $_ > 10 ){ $format = $blue; } $sheet -> write(0, $cell++, $_, $format); } $workbook -> close() or die "Error closing file: $!";