I agree that the rules are a little confusing. Assuming AAAAAA should be deleted, then how about this.
#!/usr/bin/perl
use strict;
my @foo = ('AAAAAA', 'ATATAT', 'AATAAT');
foreach (@foo) {
print "$_\n" if substr($_,0,3) eq substr($_,3,6);
}
--
http://MyUniversityTutor.com
If you have an array @a in perl(< 6), then you access the ith element with $a[$i] instead of @a[$i]. That's all the warning is saying. I think that changes with perl6...
I've never used Spreadsheet::ParseExcel::Simple, but I think you can check the value of the LAVG_1min column with $data[2]...
Have you looked at the module? You're using SQL, and Class::DBI is a module that deals with SQL. I was just saying that if you're using Class::DBI, then you don't have to issue a statement and look for errors. You can just override the _croak function and you'll get all the errors. If you're not...
If you're using Class::DBI then you just override the _croak function.
http://search.cpan.org/~tmtm/Class-DBI-v3.0.17/lib/Class/DBI.pm#EXCEPTIONS
--
http://MyUniversityTutor.com
What OS are you on? Do you have to use perl? If you're on Linux, you can just do this from the shell:
find * -mtime +89
If you're on Windows or you have to use perl, then you can use File::Find and stat.
--
http://MyUniversityTutor.com
I've never done it before, but check out this post. There are a lot of suggestions -- I'm sure one of them will work for you.
http://www.perlmonks.org/?node_id=680907
--
http://MyUniversityTutor.com
Okay, I see what's going on. grep returns the elements of the list when the expression returns true. Your 2nd snippet actually modifies @input, evaluates to true, and returns that element. The 1st snippet just does some irrelevant calculations, evaluates to true, and returns the element from...
Hm. That's pretty weird. I'm not sure what's going on there, but I can tell you that this isn't how grep is supposed to be used -- it's used to find stuff in a list, but not operate on it. I think what you want is map. Check out these examples. Sorry I can't tell you about the weird results...
Does that mean you don't want to do this in perl anymore?
If you still need help, then show us what you have in shell scripting and we can help you port it to perl, or show us what you have in perl so far and we can help you build on that.
--
http://MyUniversityTutor.com
Try this.
# Build an array of the stats type to be collated
#my @stat_type=split(/:/, $PARAMS{COLLATE_STAT_TYPES});
@stat_type=@uniq;
# for each of the stats type, read the xls of each hour and write into a consolidated xls.
foreach my $stat_type_token (@stat_type){
my $con_wb =...
It looks like you're missing a '{' at the end of this line
foreach my $row_index ($source_sheet->{MinRow} .. $source_sheet->{MaxRow})
It also looks like you're setting $first_file to 'no' outside of the loop. Try fixing your indentation so it's easier for you (and us) to read.
--...
I don't use windows, so I've never used Win32::OLE and I don't know what a subroutine in an mdb file would look like. If you can post the file, then I can start playing around and see if I can figure something out.
--
http://MyUniversityTutor.com
Oops. Looks like
next if $row_index == $source_sheet->{MinRow} && $first_file ne "no";
should be
next if $row_index == $source_sheet->{MinRow} && $first_file eq "no";
You're also changing $first_file to 'no' at the end of the loop, right?
What's this line for?
next if $row_index ==...
You're right, it's trying to find the smallest possible match when you use '?'. Look at it from left to right:
$s = '-html=-head=head data-head=-body=BODY-body=-html=';
DISCLAIMER
I'm sure this isn't the actual way Perl does goes about pattern matching, but this is what I say to myself as...
You just need to get rid of some parentheses.
while($read=~/(NM|\s\*\s)/g){
The way you have it, 'NM' will be saved in $1 and '*' will be saved in $2.
--
http://MyUniversityTutor.com
When you say that neither of them work, what exactly do you mean? They give you no output? They die with errors?
Can you post that access file? I don't have access.
--
http://MyUniversityTutor.com
You have this line
next if $row_index eq (($source_sheet->{MinRow}) && ($first_file ne "no"));
That looks odd. I think you want
next if $row_index == $source_sheet->{MinRow} && $first_file ne "no";
I can't see where you're changing $first_file from "yes" to "no". You could make it the...
Is there a particular reason you've chosen that over a CPAN module? If not, I'd look into CPAN. CPAN modules are easy to install too.
If you have to use this particular tool, then try to use yum rather than doing everything manually. You could, for instance:
sudo yum install rrdtool
sudo yum...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.