- Well what are you comparing them to? what are you searching in? you are searching for your name: my $name = wayne clements ; So you need to split it up... myMessage 1 of 3 , May 2, 2003View SourceWell what are you comparing them to? what are you searching in? you are
searching for your name:
my $name = 'wayne clements';
So you need to split it up...
my @tmp = split / /, $name;
Now @tmp should look like this:
$tmp = 'wayne';
$tmp = 'clements';
And now the regex part, I don't understand what you want. Do you want to
have regex return true if the word 'wayne' and 'clements' is anywhere in
the file and any number of times? Do you want it to ONLY be true if each
word appears ONLY once? You should check out perlre it has information on
the perl regex but thats what you are going to be doing afte rwhat I show
above... I just am not clear what regex you need. =P
Plus go read the perlre page it will help you understand and you can
figure this out on your own.
[Non-text portions of this message have been removed]
- ... Did you notice you forgot to include sample code? -- James Chip Kaufman firstname.lastname@example.org PGP key: 697D43DEMessage 2 of 3 , May 2, 2003View SourceOn Friday 02 May 2003 09:37, diheptal wrote:
> hi,Did you notice you forgot to include sample code?
> i want to search a file for a user entered string from STDIN,
> perhaps a first name and a second name.
> i only want the exact string entered and only one occurrence of
> each word.
> so if i entered my name ['wayne clements', separated by white space],
> i want perl to find these two words.
> [after this i intend to do some substitutions, but forget that for
> so far, all i get is every occurrence of each letter entered.
> NOT what is wanted.
> any ideas will be gratefully received.
James 'Chip' Kaufman
PGP key: 697D43DE