my $skip_count = 0;
while (<>) {
chomp;
if (/^Foo$/) {
$found_foo = 1;
print "$_\n";
next;
}
if ($found_foo) {
$skip_count++;
next if $skip_count <= 2;
}
velope information. So it is easy to generate a technically
illegal message. Also note that any header can be folded, although it is
typically only the Received: headers which are routinely wrapped for
readability.
As usual when writing code against a protocol standard, be liberal
in what you will accep
}
Write get_mail_header to return the next valid header or undef at the
end of the headers.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
; {
> print $_ . "\n";
> }
You can use the POSIX module's isatty function. Something like:
use POSIX qw(isatty);
exit 0 if isatty(STDIN);
If STDIN is not a tty then it must be a pipe.
Alternatively, you can use the '-t' operator:
exit 0 if -t STDIN
--
S
something like:
$name =~ s/\d+.*//;
which matches one or more digit characters followed by anything.
See the perlre man page for details on Perl regular expressions.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To uns
my simple Perl
tools with the following paradigm:
process any flags here
while (<>) {
do something with the input
}
The magical <> operator is very handy.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
On Mon, 29 Mar 2004 12:14:49 -0600
James Edward Gray II <[EMAIL PROTECTED]> wrote:
> On Mar 29, 2004, at 11:02 AM, Smoot Carl-Mitchell wrote:
>
> > On Mon, 29 Mar 2004 15:05:34 +0530
> > "MuthuKumar" <[EMAIL PROTECTED]> wrote:
> >
> >>
unter. % is the modulo operator. See perlvar for the
details on $. and perlop for the modulo operator.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
$pid1=wait;
> }
The above works, but it is equivalent to:
system("XYZ -a $check");
You should check the return value of system. A non-zero value means the
forked program returned a non-zero exit status which depending on what
you do with the output may or may not be an error.
--
Smoo
rds) {
> ...
> }
$#records returns the index of the last element in the array. @records
in scalar context returns the number of elements in the array. With
array indices starting at zero, #$records + 1 == @records.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PR
stead of reading or writing from a file, the
program reads or writes a socket which is typically connected to
another program via a network protocol which is either local or remote.
See perldoc -f socket.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421
nvert the dotted decimal
representation of each IP address to a number and do a direct
numeric comparison.
You might also take a look at the CPAN module Net::IP::Match. It looks
like it does what you want to do unless you really want to code up your
own solution from scratch.
--
Smoot Carl-Mitchel
king routine which explains how to use flock to grant exclusive
access to a file.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAI
ter opening it. The directory
entry for the file is deallocated, but the file is still open. When the
file is closed, the disk allocation for the file is reclaimed.
This is a handy method for creating temporary files that you want to be
sure get deallocatted when the program using the temporary f
copy of itself and is waiting
for input or waiting to send output to the terminal or has been stopped.
That is what the 'T' means in the ps listing.
Are you sure you are executing /bin/ls and not some other ls program in
your PATH? Try doing an strace on the stopped process and see wh
ther the given argument
> or $_ how would you do that?
$_ is global, so do something like:
sub test {
my $arg;
$arg = shift or $arg = $_;
}
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubs
$line =~ s/\*|/|/mg;
> print NEWFILE "$line\n";
> }
> close OLDFILE;
> close NEWFILE;
>
> print "$newfile has now been created\n";
> }
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED
On 3 Apr 2004 14:40:43 -
[EMAIL PROTECTED] (Peter Scott) wrote:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Smoot Carl-Mitchell) writes:
> >On Fri, 02 Apr 2004 10:37:14 -0600
> >"JupiterHost.Net" <[EMAIL PROTECTED]> wrote:
> >
> &
On Sat, 3 Apr 2004 11:04:35 -0600
"Charles K. Clarkson" <[EMAIL PROTECTED]> wrote:
> Smoot Carl-Mitchell <[EMAIL PROTECTED]> wrote:
> : > >sub test {
> : > >
> : > > my $arg;
> : > > $arg = shift or $arg = $_;
> : > >
er in my original response, since I had never done such a
thing in my own Perl coding and I was curious enough to come up with
what turned out to be a buggy solution. Live and learn.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1
ntly has no copyright at all.
If there is interest, I will do the work to GPL it and put it up on my
FTP site.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comma
st
> with perldoc.com) and check out the FAQs
> (http://www.lns.cornell.edu/~pvhp/ptk/ptkFAQ.html) and go from there.
I concur with this assessment. Also the Perl/Tk module comes with some
example programs which are also very useful learning tools.
--
Smoot Carl-Mitchell
Systems/Network A
if($rc == 4) { warn "rats! Exclusive lock not granted, oh well...";
> } if(!$rc) { die "Could not get lock no how mr flock guy!"; }
The return code with LOCK_NB is false if the file is locked by another
process, true is you got the lock. $! holds the appropriate error
message
et = flock(ZZZ, LOCK_EX | LOCK_NB);
print "$ret $!\n";
sleep 60;
> Thanks for the info BTW I really appreciate it! :)
No problem.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mai
On Sat, 10 Apr 2004 17:07:02 -0700
"Chance Ervin" <[EMAIL PROTECTED]> wrote:
> Is there an easy way to check which user is running your scripts?
See $< and $> in perlvar.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9
nctionality as expect, but is IMHO a bit more rational.
BTW, expect is not written in Tcl. It uses Tcl syntax for flow control,
but it is a separate language. The Unix version is written in C as is
Tcl.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421
ss, since you do need the Tcl libraries to build the expect binary
on Unix systems. I went thru that process around 1992 when I first
discovered expect.
--
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe,
vided your laptop has a valid host to IP address
translation available. On Unix typically either an entry in /etc/hosts
or a DNS A record entry.
Take a look at Net::Interface on CPAN. It appears to let you look at
interface information in a system independent way.
--
Smoot Carl-Mitchell
Sy
Note the quoting gets really convoluted, since you have to worry about
Perl's quoting conventions and two layers of shell quoting. Anything
more complicated than this short example and I would go ahead and create
a shell script and call it explicitly.
Better, yet, write the shell functionality i
the quoting gets really convoluted
>
> No kidding... Sometimes the list form of system() makes this easier,
> and non-interpolating quotes always help.
>
> system qw(ksh -c), 'TEST=hello; echo $test';
Good point. This does make it easier to read. In your example $test
should
>error. Any ideas ??
Look at the Expect module. It gives you the ability to automate
interactive tasks.
--
Smoot Carl-Mitchell
Systems/Networking Consultant
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additiona
space character and the .jpg
ending. I made the $_ explicit for clarity.
--
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
sm...@tic.com
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
ver the current directory and returns every filename in
the directory to the $_ variable. The '*" can be any glob pattern. e.g.
for the specific jpg files in the example, I could have used <*.jpg>
--
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell:
33 matches
Mail list logo