NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: easy as
by Sherlock (Deacon) on May 11, 2001 at 17:45 UTC
    Well, it looks to me like you're trying to convert a C++ program to Perl. If that's the case, there isn't a CIN and COUT in Perl. Use these instead:

    use strict; print "Insert Employee Number: "; # Prompts the user my $empNum = 1; while ($empNum) { $empNum = <>; # Gets input from STDIN print "The employee number you enetered was: $empNum\n"; print "Insert Employee Number: "; # Prompts the user }
    If you're still having trouble with things like this, check out Tutorials - there's lots more help there.

    Update: The old code prompted for an empty line - use this instead. Sorry about that.

    Good luck,
    - Sherlock

    Skepticism is the source of knowledge as much as knowledge is the source of skepticism.
Re: easy as
by iakobski (Pilgrim) on May 11, 2001 at 18:11 UTC
    To loop on 0 or char is easier in perl than in C++, despite being loosely typed. Try this:
    use strict; { print "Insert Employee Number: "; # Prompts the user my $empNum = <>; # Gets input from STDIN redo if $empNum == 0; print "The employee number you entered was: $empNum\n"; }
    See that redo works on any block, it doesn't have to be a loop as in the documentation. It also loops when you enter a char, because it is using a numeric equality operator.

    -- iakobski

A reply falls below the community's threshold of quality. You may see it by logging in.