Rotating an Image with Perl

Turning images is quite simple. In the example below an image is turned 90 degrees clockwise, wirtten to a file, turned another 90 degress and written to a file again.

#!/usr/bin/perl -w
use strict;
use Image::Magick;

my $image = Image::Magick->new(magick=>'JPEG');
my $x = $image->Read('test.jpg');

$x = $image->Rotate(degrees=>90); # 90 degress clockwise
$x = $image->Write('test.90.jpg');

$x = $image->Rotate(degrees=>90); # Another 90 degress clockwise
$x = $image->Write('test.180.jpg');