Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Strings with @

by ayrnieu (Beadle)
on Mar 10, 2006 at 06:19 UTC ( #535617=note: print w/replies, xml ) Need Help??


in reply to Strings with @

#! /usr/bin/env perl use strict; use warnings; open my $f, 'netapsp' or die "open failed: $!"; my $recip = 'some.g.guy@bigcorp.com'; while (<$f>) { chomp; system "rsh $_ quota report | mail $recip" and die "rsh failed: $!"; }

Morever, with such a simple program you've little excuse to not use tainting (perldoc perlsec), which would've suggested that you verify what you get from 'netapps' rather than blindly pass it to a shell.

Replies are listed 'Best First'.
Re^2: Strings with @
by stubblyhead (Initiate) on Mar 10, 2006 at 17:18 UTC
    while (<$f>) { chomp; system "rsh $_ quota report | mail $recip" and die "rsh failed: $!"; }
    shouldn't that be or die rather than and die?

      No, it should not. Unix programs return 0 on success.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://535617]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2022-01-22 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (62 votes). Check out past polls.

    Notices?