I don't understand your question. It's usually better to include sample input data (within <code> tags) and expected output.
If you want to work with the first line only, don't use while. If you want to compare two string values, you should use eq, ne, or index, or maybe a regex: $value =~ /\Q$important/.
Update: example script added:
#!/usr/bin/perl use warnings; use strict; my $first_line = <DATA>; my $important = (split ' ', $first_line)[0]; while (<DATA>) { # Process the remaining lines. my $value = (split)[0]; print if $value eq $important; } __DATA__ john chevrolet usa hans bmw germany ivan lada russia john talbot uk
In reply to Re: How do I select first string of a two dimensional array to compare to other values?
by choroba
in thread How do I select first string of a two dimensional array to compare to other values?
by joi1369
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |