this one finally worked! thanks you two!
#! c:\perl
my $input;
print "Enter a phrase and convert the first letter to upper case and
add a ! at end: ";
chomp( $input = <STDIN> );
my $firststinput = ucfirst( $input );
print $firststinput, "\!", "\n";
On Oct 10, 9:53*am, April <xiaoxia20...@yahoo.com> wrote:
> thanks, however after the recommended change the script hangs
> forllowing keyboard entry:
>
> #! c:\perl
> print "Enter a phrase and convert the first letter to upper case and
> add a ! at end: ";
> my $input = <STDIN>;
> chomp( $input = <STDIN> );
> my $firststinput = ucfirst($input);
> print $firststinput, substr($input, 1), "\!", "\n";
>
> C:\Perl\Exercise1>perl new3-6d.pl
> Enter a phrase and convert the first letter to upper case and add a !
> at end: thank you
>
> On Oct 10, 9:42*am, Peter Makholm <pe...@makholm.net> wrote:
>
>
>
> > April <xiaoxia20...@yahoo.com> writes:
> > > print "Enter a phrase and convert the first letter to upper case and
> > > add a ! at end: ";
> > > my $input = <STDIN>;
>
> > Here you string will have an newline at the end. You'll have to chomp it.
>
> > > my $firststinput = uc( substr($input, 0, 1) );
> > > print $firststinput, substr($input, 1), "\!", "\n";
>
> > Uhmmm, and use ucfirst if that is what you need to do.
>
> > //Makholm- Hide quoted text -
>
> - Show quoted text -
|