#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use v5.10; sub view_all_railcars { say "View All Cars"; *MYINPUTFILE = *DATA{IO}; # To simulate the input. my $viewlines = 4; print "=====================\n"; print "|CAR MODEL|CAR OWNER|\n"; print "=====================\n"; while () { chomp; my ($VcarModel, $VcarOwner) = split /:/; $_ //= q() for $VcarModel, $VcarOwner; if ($. > 1 and $. % $viewlines == 1) { <>; } else { print "\n"; } my $format = " %-13s %0s\n"; printf $format, $VcarModel, $VcarOwner; } print ("\n\n\nWHEN YOU ARE DONE VIEWING HIT RETURN: \n\n\n"); do 1 until defined <>; # Do not end on CTRL+D say 'cls'; say 'Menu'; } view_all_railcars(); __DATA__ Ford|Philip Renault|Renee Citroen|Cyrill Mercedes|Mike Chrysler|Chris Bentley|Brian BMW|Brittney Chevrolet|Shirley Skoda|Stanley