- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Perl Script help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2005 11:07 AM
10-27-2005 11:07 AM
Perl Script help
The 4 people receiving them currently are Molly, Bruce, Peter. I would like to remove Bruce and Peter from the distribution list and add Tom to the list.
With in the script, in this particular section..
sub getDistList{
my $C = "select email from rpt_dist where rpt_id = '$_[0]';";
# die "$rptNam";
my $sth=$dbh->prepare($C);
if ( !defined $sth ) {
die "DML Error, Cannot prepare Dist List statement: $DBI::errstr";
}
if($sth->execute){
my $ntuples = $sth->rows;
if ($ntuples > 0) {
for ( my $i=0; $i < $ntuples; $i++) {
@row = $sth->fetchrow; # Get a row
$row[0] = &clip($row[0]);
$distList .= "$row[0]; ";
}
....
within the four loop, how can I add a statement that says to only send mail to Molly, Kim and to not send it to Bruce and Peter.
Tahnks and points will be assigned.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2005 12:53 AM
10-28-2005 12:53 AM
Re: Perl Script help
for ( my $i=0; $i < $ntuples; $i++) {
@row = $sth->fetchrow; # Get a row
$row[0] = &clip($row[0]);
$distList .= "$row[0]; ";
}
to:
for ( my $i=0; $i < $ntuples; $i++) {
@row = $sth->fetchrow; # Get a row
$row[0] = &clip($row[0]);
if ($row[0]=~/Molly/ or $row[0]=~/Kim/) {
$distList .= "$row[0]; ";
}
}
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2005 07:24 AM
10-28-2005 07:24 AM
Re: Perl Script help
sub getDistList{
451 my $C = "select email from rpt_dist where rpt_id = '$_[0]';";
452 # die "$rptNam";
453 my $sth=$dbh->prepare($C);
454 if ( !defined $sth ) {
455 die "DML Error, Cannot prepare Dist List statement: $DBI::errstr";
456 }
457
458 if($sth->execute){
459 my $ntuples = $sth->rows;
460 if ($ntuples > 0) {
461 for ( my $i=0; $i < $ntuples; $i++) {
462 @row = $sth->fetchrow; # Get a row
463 $row[0] = &clip($row[0]);
464 if (row[0]=~/Molly/ or $row[0]=~/Kim/) {
465 $distList .= "$row[0]; ";
466 }
467 }
468 }
When I execute it as such..
perl secdaily.test, I get the following error..
syntax error at secdaily.test line 464, near "row["
syntax error at secdaily.test line 469, near "}else"
Execution of secdaily.test aborted due to compilation errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2005 07:32 AM
10-28-2005 07:32 AM
Re: Perl Script help
DIST_LIST:**
Before I made the chaange to add that statement, I was getting the following..
DIST_LIST:*msilva@pacificex.com; parmstrong@pacificex.com; bburke@pacificex.com; msilva@pacificex.com; parmstrong@pacificex.com; bburke@pacificex.com; *
Like I mentioned that what I want to do is be able to remove peter and bruce from the maillist. Also I woul dlike to add Tom to this list.
Thanks for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2005 02:51 AM
10-29-2005 02:51 AM
Re: Perl Script help
It appears there is a typo on line 464. It reads "if (row[0]......" and should be "if ($row[0]..."
Hope this helps,
JL