#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11129830 use warnings; my $format = "%-25s%-15s%-14s%-24s%s\n"; printf $format, split / +/, 'Product Release product Type color basic color all overseas shipping'; local ($/, @ARGV) = ('', 'input.txt'); while( <> ) { printf $format, /(Release Date\S+)/ ? "$1" : 'N/A', /(?|product clock\d\((\w+)\)|product (\w+))/ ? "$1" : 'N/A', /color basic (\S+)/ ? "$1" : 'N/A', /color all (\S+)/ ? "$1" : 'N/A', /overseas shipping (\w+)/ ? "$1" : 'N/A'; } #### Product Release product Type color basic color all overseas shipping Release Date2/2/2019 analog white white,black,silver N/A Release Date2/2/2020 none N/A N/A N/A Release Date2/2/2021 digital black black,silver N/A Release Date2/2/2022 digital white white yes