If you like to use object oriented features, you can make your task easier.
#!/usr/bin/perl -w
package Vertex;
sub new {
my $class = shift;
my $self = [@_];
bless $self, $class;
}
package Block;
sub new {
my $class = shift;
my $self = [@_];
bless $self, $class;
}
package main;
use strict;
# @blockList has 2 blocks b1 and b2
# Block b1 has 2 vertexes v1 and v2
# Block b2 has 3 vertexes v1, v4 and v3
# Vertex v1 has 3 points (2,3,4)
# Vertex v2 has 3 points (5,6,7) ....
my @blockList;
my $v1 = new Vertex(2,3,4);
my $v2 = new Vertex(5,6,7);
my $v3 = new Vertex(8,9,10);
my $v4 = new Vertex(11,12,15);
my $b1 = new Block($v1,$v2);
my $b2 = new Block($v1,$v4,$v3);
push @blockList,($b1,$b2);
Just a curiosity...
Is this for a game design or graph theory?. There might be something more available on the
CPAN for your purpose.
artist
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.