Re: Changing case of the first letter of words in string

2003-08-22 Thread David K. Wall
Bis <[EMAIL PROTECTED]> wrote: I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string SC

Re: How to replace a text in a file

2003-08-14 Thread David K. Wall
Vinay Thombre <[EMAIL PROTECTED]> wrote: [attribution inserted] "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> wrote open INPUT, "< in.txt" or die "can't read in.txt: $!"; open OUTPUT, "> out.txt" or die "can't write out.txt: $!"; while (my $line = ) { # do something to $line print OUTPUT

Re: How do I return more than 1 array from a sub routine ?

2003-08-14 Thread David K. Wall
"T.S.Ravi Shankar" <[EMAIL PROTECTED]> wrote: Hi all : How could I return more than 1 array or hash from a sub routine & collect them in different arrays or hashes in the calling program ?? Return references to the arrays. Here's an example: sub demosub { my @array1 = 1..10; my @array2 = '

Re: Simple question

2003-08-14 Thread David K. Wall
Trevor Morrison <[EMAIL PROTECTED]> wrote: I am trying to compare two arrays to find common numbers in both. For the numbers that are not common to both, I want to write them to a file for my review. Check the FAQ: perldoc -q "difference of two arrays" How do I compute the difference of two ar

Re: [solved but..] Push first 9 elements

2003-08-01 Thread David K. Wall
Janek Schleicher <[EMAIL PROTECTED]> wrote: John W. Krahn wrote at Thu, 31 Jul 2003 00:22:04 -0700: If you are just removing one element then you can use shift instead. And you are not really using $i it seems. for ( 0 .. @archivo - 4 ) { push @lista_final, shift @correos_p; push @list

Re: pattern matching

2001-11-19 Thread David K. Wall
[EMAIL PROTECTED] (Andrea Holstein) wrote: > Prasanthi Tenneti wrote: >> >> Iam a beginner in perl.I have one question, Iam trying to write one >> prog,in which i have to search for one word in a file, If I found that >> word,print next 4 lines. PLs help me,how to write code. > > open FILE, "