#!/usr/bin/perl use strict; use warnings; # Data my $p_expected_output = [ '0601|3|NORM|2|ALLO|XLF753|U|0045|0050|', '0603|5|NORM|2|ALLO|ADR2CG||0430|0438|', '0604|6|NORM|2|ALLO|AF681VC|i U|0500|0510|', '0605|7|NORM|2|ALLO|AF651PQ|i|0515|0523|', '0606|8|NORM|2|ALLO|AF713BR|i|0445|0453|', '0607|9|NORM|2|ALLO|AFR100M|i|0520|0533|', '0609|11|NORM|2|ALLO|GJT775|i E|2300|2315|', '0610|12|NORM|2|ALLO|AF661WN|i|0450|0500|0500|', ]; my $p_input = [ '0601 3 NORM 2 ALLO XLF753 U 0045 0050 ', '0603 5 NORM 2 ALLO ADR2CG 0430 0438 ', '0604 6 NORM 2 ALLO AF681VC i U 0500 0510 ', '0605 7 NORM 2 ALLO AF651PQ i 0515 0523 ', '0606 8 NORM 2 ALLO AF713BR i 0445 0453 ', '0607 9 NORM 2 ALLO AFR100M i 0520 0533 ', '0609 11 NORM 2 ALLO GJT775 i E 2300 2315 ', '0610 12 NORM 2 ALLO AF661WN i 0450 0500 0500 ', ]; # Main program my $p_output = generate_output($p_input); if (arrays_match($p_output, $p_expected_output)) { print "Success!\n"; } else { print "Generated output does NOT match expected output :-(\n"; }