Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rectangle using Perl

The code:

use strict;
use warnings;
use SVG (-nocredits => 1, -inline => 1);

my $svg= SVG->new( width => 200, height => 200);
$svg->rectangle(
    x      => 10,
    y      => 20,
    width  => 180,
    height => 120,
    rx     => 10,
    ry     => 30,
    fill   => "#3a83c5",
);
print $svg->xmlify();

The generated SVG

<svg height="200" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<rect fill="#3a83c5" height="120" rx="10" ry="30" width="180" x="10" y="20" />
</svg>

The image:

Rectangle