10 msgText formatting issues
1 msgre: find path to current file, NOT working dire...
2 msgPassing Creadentials and parameters through htt...

how to shorten this code ? x occur how many tim...
\ Richard Lee (7 May 2008)
. \ John W. Krahn (7 May 2008)
. . \ Richard Lee (7 May 2008)
. . . \ Rob Dixon (7 May 2008)
. . . . \ Richard Lee (7 May 2008)
. . . . . \ John W. Krahn (8 May 2008)
. . . . . . \ Richard Lee (8 May 2008)

1 msgCompare String is not match !
3 msgCompile error
5 msgchaining defines
2 msgsed split on pipe
4 msgcsv file question
6 msgWriting side of square
11 msgcomparing kit names
2 msgOT: help crle ruin my solaris :-(
6 msggenerating number ranges using rand function
1 msgquestion on unblocking the signals
5 msghowto simplfy this regex if ($string =~/^$match...
7 msghow to reun perl script on other pc without hav...
14 msghow to simplify this script
10 msgdisplaying inline images in HTML email
15 msganother help on input record separator clarity ...
2 msgPerl Expect help
Subject:how to shorten this code ? x occur how many times in variable
Group:Perl-beginners
From:Richard Lee
Date:7 May 2008


 
Can you please tell me how to shorten this?

my @an = split(//);
my @num = grep { $_ eq ':' } @an ;

I was trying to see how many : occur in variable but didn't know how to
do it fast so i did it like above...

I would like to see as many way different ways to get this done if possible

thank you!!


$var1 = root:x:123:/root:

trying to see how many times : occurs in $var1..... and I could only do
it above way....


--
To unsubscribe, e-mail: beginners-unsubscribe
For additional commands, e-mail: beginners-help
http://learn.perl.org/




© 2004-2008 readlist.com