Which prints:#!/usr/bin/perl -w use strict; use warnings; my @varNames = qw { name vorname plz tel tel49 }; my @vars; while (<DATA>) { print; chomp; (@vars) = split /\s*,\s*/; print "\t"; for my $var (@varNames) { print $var, ":", shift @vars ? "good " : "bad "; } print "\n\n"; } __DATA__ john, stuart, some_plz, 123456, 234557 john, stuart, some_plz, 123456, john, stuart, some_plz, 123456 john, stuart, some_plz,, 234557 , stuart, , 123456, 234557 ,,,123456, 234557 john,,some_plz,, 234557
--roboticusjohn, stuart, some_plz, 123456, 234557 name:good vorname:good plz:good tel:good tel49:good john, stuart, some_plz, 123456, name:good vorname:good plz:good tel:good tel49:bad john, stuart, some_plz, 123456 name:good vorname:good plz:good tel:good tel49:bad john, stuart, some_plz,, 234557 name:good vorname:good plz:good tel:bad tel49:good , stuart, , 123456, 234557 name:bad vorname:good plz:bad tel:good tel49:good ,,,123456, 234557 name:bad vorname:bad plz:bad tel:good tel49:good john,,some_plz,, 234557 name:good vorname:bad plz:good tel:bad tel49:good
In reply to Re^2: A Case with 5 Var's
by roboticus
in thread A Case with 5 Var's
by ultibuzz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |