I managed to get it working.

I changed you code a little here is what I came up with.

Firstly...
elsif ($option eq 'f') { print "Who are you looking for?\n"; &find; }
changed to
elsif ($option eq 'f') { print "Who are you looking for?\n"; chomp(my $f = <STDIN>); $f =~s/\cM//g; if (!&find($f)) { print "Name $f cannot be found in the directory.\n"; }
Then I changed you find sub from
sub find { chomp(my $f = <STDIN>); # $f=~tr/\r\z//d; #$f =~s/\r\z//; $f =~s/\cM//g; if (exists $dbm{$f}) { my($name, $number, $email, $addr1, $addr2) = split "\0", $dbm{$f} +; print "$name\n$number\n$email\n$addr1\n$addr2\n\n\n"; } else { print "Name $f cannot be found in the directory.\n"; } }
to look as follows
sub find { my $rc = 0; my $f = shift; foreach my $key ( sort keys %dbm ) { my($name, $number, $email, $addr1, $addr2) = split "\0", $ +dbm{$key}; if ($name eq $f) { print "$name\n$number\n$email\n$addr1\n$addr2\n\n\n"; $rc = 1; last; } } }

Disclaimer: I know nothing about tie and less about SDBM_File but thats why I like perl.

-----
Of all the things I've lost in my life, its my mind I miss the most.

In reply to Re: Flawless Script problems? by AcidHawk
in thread Flawless Script problems? by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.