in reply to Advice on goto usage?

You want to avoid goto for this kind of thing - you are better off using a conditional looping construct:

#!/usr/bin/perl -w # + use strict; + my $value; + while ( not defined $value or $value eq 'R' ) { chomp($value = <STDIN>) + if ( $value eq 'E') { exit; } }
update: removed the extraneous while

/J\

Replies are listed 'Best First'.
Re^2: Advice on goto usage?
by mrborisguy (Hermit) on May 05, 2005 at 14:11 UTC
    while ( while not defined $value or $value eq 'R' )
    do you need the second 'while' in here?

      Er no it was a typo - I have removed it now.

      /J\