in reply to select elements in a list

This code demonstrates some basics about opening and closing a file, using a regular expression to search for specific lines, and using strictures (warnings/strict) to enforce good coding practices.
#!/usr/bin/env perl use warnings; use strict; open my $fh, '<', 'foo.txt' or die "Can not open file: foo.txt: $!\n"; while (<$fh>) { if (/^\w{3};\w/) { print; # or do whatever you need to do... } } close $fh or die "Can not close file: foo.txt: $!\n";
Here is the output, assuming "foo.txt" is your start file:
TEC;UTF;TDE;450 TEC;URT;TDE;687 TEC;UGC;TDE;687