I am taking a file and trying to create report Data is Name Street Zip and I want each to appear on it's own line: Name: Fred Street: Green Zip 55505 Below is the code and error message.
#! /usr/bin/perl use v5.16.3; use strict; use warnings; use diagnostics; ######################################################### ## # ## 9/4/20 # ## Program takes white space separated values and # ## produces a report for each line # ## # ## # ######################################################### chomp( my $header = <> ); my @field_names = split /\s+/, $header; while( <>) { chomp; my @fields = split /\s+/; foreach my $index (0 .. $#fields ) { print "$field_names[$index]: $fields[$index]\n" } } Use of uninitialized value within @field_names in concatenation (.) or + string at ./Exercise_9_6.pl line 26, <> line 3 (#1)
TIA The Catfish </post>
In reply to Creating report by catfish1116
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |