Re: Counting Matches In A Line

2006-12-05 Thread Chris Wagner
At 01:33 PM 12/5/2006 -0800, $Bill Luebkert wrote: >Sure you can. The unused/skipped cells will be undef which you >can check for on the print. undef is also a legal rvalue. Perl autoextends arrays with undef values. So regardless, perl will consider those offsets to "exist". Say he had lines w

Re: Counting Matches In A Line

2006-12-05 Thread $Bill Luebkert
Chris Wagner wrote: > At 02:39 PM 12/5/2006 -0500, Joe Discenza wrote: > >>The tr/// operator counts all the occurrences of the translated >>character(s) in $_ (the default), and then you just increment the @semis >>array at the index of the number of semicolons found to indicate another >>line w

RE: Counting Matches In A Line

2006-12-05 Thread Chris Wagner
At 02:39 PM 12/5/2006 -0500, Joe Discenza wrote: >The tr/// operator counts all the occurrences of the translated >character(s) in $_ (the default), and then you just increment the @semis >array at the index of the number of semicolons found to indicate another >line with that number of semicolons.

RE: Counting Matches In A Line

2006-12-05 Thread Joe Discenza
EwenMarshall wrote, on Tuesday, December 05, 2006 2:23 PM : All I want to do is count the number of ;'s on each line of : 15,000'ish lined text file. The first 3 lines look like : (FINISH; is the end of 1 line): : : NEW ANALOGUE; A.PS.19.601; 0; 4;NA; 0;OFF;%;NO; 100.0; : 0.0;"AN

RE: Counting Matches In A Line

2006-12-05 Thread Tobias Hoellrich
This: cut here while() { $cnt=()=$_=~ /;/g; $matches{$cnt}++; } print "found $_ ; in $matches{$_} line(s)\n" foreach (sort {$b <=> $a } keys %matches); __DATA__ NEW ANALOGUE; A.PS.19.601; 0; 4;NA; 0;OFF;%;NO; 100.0;0.0;"ANALOGUE CARD #100 INPUT

RE: Counting Matches In A Line

2006-12-05 Thread Andy_Bach
> The match condition is number of ; in 1 line Output: found 14 ; in 1,232 lines found 13 ; in 7,456 lines found 12 ; in 2,321 lines my %line_counts; while (<>) { my $semis = tr/;/;/; if ( $semis ) { $line_counts{$semis}++; } else { warn("Bad data - no semis: $_"); }

RE: Counting Matches In A Line

2006-12-05 Thread EwenMarshall
All I want to do is count the number of ;'s on each line of 15,000'ish lined text file. The first 3 lines look like (FINISH; is the end of 1 line): NEW ANALOGUE; A.PS.19.601; 0; 4;NA; 0;OFF;%;NO; 100.0; 0.0;"ANALOGUE CARD #100 INPUT NO 01";FLOAT;FINISH; NEW ANALOGUE; A.PS.19.602;

Re: Counting Matches In A Line

2006-12-05 Thread Chris Wagner
We need some more information. What is the match condition and how do u find the number of matches? If ur just trying to record the number of "something" per line so that u can go back and correlate the number to the line, then u can't use foreach. U have to iterate over the array so u can get t

Counting Matches In A Line

2006-12-05 Thread EwenMarshall
Hi Guys, How do I count matches in each line of a foreach loop... Use strict; My ($line,@match_count); My @data = ("ALM1;;\"Alarm 1\";;FINISH;", ";ALM2;;\"Alarm 2\";SCO;FINISH;"); Foreach $line (@data) { My $number=0; # Code to count ; in each line Push @match_count, "$number"; } Print "Outp

trouble with insert in MS SQL

2006-12-05 Thread Dan Jablonsky
hi all, haven't worked with this for a while - still, don't remember getting this error message ever ... The code I'm running is below: use Win32::OLE; use Win32::OLE::Const; $db = "db1"; $srv = "mySrv"; $uid = "usr1"; $pwd = "usr1pwd"; #this is an OLEDB connection to a MS-SQL Database $connSt

FW: How to save the attachment in Microsoft outlook using perl-code

2006-12-05 Thread Benoit Quenneville
* # Count a attachments* *my* $AttachmentNb = $message->Attachments()->Count(); *# Create attachments filename list * *my* $AttachmentsList; *if*($AttachmentNb > 0){ *for* (*my* $i=1;$i <= $AttachmentNb;$i++){ *# Add attachment filename to the list * $AttachmentsList .= $message->Attachments()->I