in reply to Changing the first word to uppercase
i know how to change field by field but i dont know this task as its not seprated in diff fields. the whole text is one field as below
I'm not sure what you mean by this. Surely the line has separate fields delimited by space characters. Uppercasing the first field seems to work although other proposed solutions using regex substitution are the best way to go.
use strict; use warnings; print map { join q{ }, uc $_->[ 0 ], @$_[ 1 .. $#{ $_ } ] } map { [ split m{ } ] } <DATA>; __END__ hello h e l l o bye b y e bike b i k e
Produces
HELLO h e l l o BYE b y e BIKE b i k e
I hope this is useful.
Cheers,
JohnGG
|
|---|