in reply to Re: Useless Program
in thread Useless Program

You're obviously right about the regex, but would you need it in the first place? If your file looks like
foo bar baz
and the input is "foo\n", why would you want to:am I missing something, or isn't it just easier to say $name eq $_ and leave it at that?

#!/home/bbq/bin/perl
# Trust no1!

Replies are listed 'Best First'.
RE: RE: Re: Useless Program
by ivory (Pilgrim) on Jun 02, 2000 at 03:12 UTC
    Well...if you don't use ^ and $ it could match a name that includes the name you are searching for...for example if $name = 'bob' it would match bobbie, bobby, etc... Just a thought... --Amber
RE: RE: Re: Useless Program
by btrott (Parson) on Jun 02, 2000 at 00:24 UTC
    No, you're right--in this case, that's much easier, faster, and better. I suppose I was just giving general advice (quoting meta-characters, not escaping $, etc.).

    Of course, the easiest would probably be just to use tie and a DBM, as was mentioned (and for which the code was even provided).

      Actually, you'd make a better teacher than myself. :)

      I was sticking strictly to the problem at hand, while you were expanding it and recommending good practices. I tend to have a very focused-on-the-job frame of mind when I read other people's code. I'll be as stupid as a debugger. At any rate, the DBM suggestion makes more sense anyway. I was just being picky.

      #!/home/bbq/bin/perl
      # Trust no1!