Hope this helps....#!/usr/local/bin/perl use strict; my $file = 'thesaurus'; # Name the file # get this into an array unless the file is too big open(INFO,$file) || die "Cannot open file"; my @lines = <INFO>; close(INFO); print " what are you looking for? "; $a = <STDIN>; chomp $a; my $found = 0; foreach(@lines){ # get the match if($found == 0){ chomp; if(/^$a$/){$found = 1;} } # print the next line else{ print; } }
In reply to Re: pattern matching
by mrmick
in thread pattern matching
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |