Execute the following on cmd line as follows $./cnt.pl <string> , You can replace the comma (,) on the command line to find any other character's occurrence in the string _______________________ #!/usr/bin/perl
for(;$i<length($ARGV[0]);$i++) { $str[i] = substr($ARGV[0],$i,1); if($str[i] eq $ARGV[1]) { $cnt++; } } print $cnt; ----------------------- Aman PS: I am just a novice, so there might be quicker ways I yet don't know of !!! -----Original Message----- From: Helen Dynah [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 11:53 AM To: [EMAIL PROTECTED] Subject: Variable question Hi everybody. I am a new user and my first question to this list is probably a very simple one. I am trying to count the number of commas in a variable. The book I am learning from doesn't cover specific information like that. Thanks for any help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]