On Thu, Nov 24, 2011 at 7:19 PM, JPH wrote:
19
20 my $hostname = $ARGV[0];
21 my $portnumber = $ARGV[1];
22 my $host = shift || $hostname;
23 my $port = shift || $portnumber;
I'm not sure what the meaning is of this but the thing that is happening is
simple enough. You have
On 2011-11-25 01:08, John W. Krahn wrote:
Or use:
close SOCKET || die "close: $!";
Instead of the more correct:
close SOCKET or die "close: $!";
Well, close takes exactly 1 parameter, so the first variant is working
correctly.
perl -MO=Deparse -e '
close( SOCKET || die "amai" )
'
close
On 26/11/2011 21:55, Brandon McCaig wrote:
I just skimmed perlop again and it doesn't seem to explicitly say
that&& and || and other related operators return the last
evaluated operand instead of a boolean (the latter being what C
and many other "static" languages do). I guess it's just
somethi
On Sat, Nov 26, 2011 at 04:19:58PM +0100, JPH wrote:
> Also I wasn't aware of the || construction to use for setting
> default values when ARGV (in this case) is undefined.
Modern Perls have a new operator, defined-or, which is //. This
is similar to || except that it tests the left operand's
defi
JPH wrote:
I think the below answers my question.
Yes. About that. Please do not top-post. TIA.
I thought maybe the code was
doing some perl magic, but it is probably just a leftover from something
else.
Also I wasn't aware of the || construction to use for setting default
values when ARG
I think the below answers my question. I thought maybe the code was doing some
perl magic, but it is probably just a leftover from something else.
Also I wasn't aware of the || construction to use for setting default values
when ARGV (in this case) is undefined.
Thnx all!
On 11/24/2011 09:05 P
JPH wrote:
I found the script below at
http://hints.macworld.com/dlfiles/is_tcp_port_listening_pl.txt
I am trying to figure out what's happening at lines 20-23.
Why is the author using 'shift ||' and not a plain $host = $hostname;
Because the author is not a very good Perl p
Errr,...
On Thu, Nov 24, 2011 at 03:05:04PM -0500, Brandon McCaig wrote:
> use List::Util;
use List::Util q/max/;
#^^^
> my $length = max map { ${#$_} } @arrays;
my $length = max map { $#{$_} } @arrays;
#^^
FTFM.
Regards,
--
Brandon McCaig
C
Hello:
On Thu, Nov 24, 2011 at 07:42:17PM +0100, Rob Coops wrote:
> I'm not sure what the meaning is of this but the thing that is happening is
> simple enough. You have @ARGV which contains [ 'A host name', 'A port
> number']. On line 20 you set $hostname = $ARG
t; Why is the author using 'shift ||' and not a plain $host = $hostname;
>
> Anyone to enlighten me?
>
> Thanks!
>
> JP
>
> ---
>
> 1 #!/usr/bin/perl -w
> 2 #
> 3 # Author: Ralf Schwarz
> 4 # February 20th 2006
> 5 #
> 6 # return
I found the script below at
http://hints.macworld.com/dlfiles/is_tcp_port_listening_pl.txt
I am trying to figure out what's happening at lines 20-23.
Why is the author using 'shift ||' and not a plain $host = $hostname;
Anyone to enlighten me?
Thanks!
JP
---
1 #!/usr/
Hi: I have created a simple script to log syslog
messages with the following lines
openlog('lab-sensor', 'cons,ndelay,nowait','local7');
syslog('debug', 'this is a test message');
When I run this locally (local hostname: nms02), the
following mes
ormat is like this:
define host{
hostname www.google.com
ipvalue1
... ...
}
define host{
hostname value2
ipvalue2
... ...
}
Its all a series of definitions enclosed with
brackets. Do you know a better solution to parse this
efine host{
hostname www.google.com
ipvalue1
... ...
}
define host{
hostname value2
ipvalue2
... ...
}
Its all a series of definitions enclosed with
brackets. Do you know a better solution to parse this
file such that
er wrote:
> > Thomas Browner wrote:
> > > Is there away to find all of the hostname on a lan with
> use of perl?
> [..]
> > You can query DNS to get the hosts in a domain using nslookup, dig,
> > host, or similar. For example:
> >
> >host -l mydomain.com
>
drieux wrote:
> On Dec 4, 2003, at 8:18 AM, Bob Showalter wrote:
> > Thomas Browner wrote:
> > > Is there away to find all of the hostname on a lan with
> use of perl?
> [..]
> > You can query DNS to get the hosts in a domain using nslookup, dig,
> > host, or si
On Dec 4, 2003, at 8:18 AM, Bob Showalter wrote:
Thomas Browner wrote:
Is there away to find all of the hostname on a lan with use of perl?
[..]
You can query DNS to get the hosts in a domain using nslookup, dig,
host, or
similar. For example:
host -l mydomain.com
If you want to talk to the
Thomas Browner wrote:
> Is there away to find all of the hostname on a lan with use of perl?
Portable to most systems:
use Sys::Hostname;
my $host = hostname;
or (on Windows systems):
my $host = $ENV{COMPUTERNAME};
or (on *nix systems):
my $host = $ENV{HOSTNAME};
--
Helgi Briem Tæknide
Thomas Browner wrote:
> Is there away to find all of the hostname on a lan with use of perl?
Getting a list of host names involves querying some kind of nameserver or
directory service. What kind of LAN? What kind of hosts?
You can query DNS to get the hosts in a domain using nslookup, dig, h
, legal API for searching newsgroups,
so you may also want to try these searches.
http://groups.google.com/groups?q=Perl+hostname
http://groups.google.com/groups?q=hostname+group%3Acomp.lang.perl.*
If you didn't get any useful results below, there's a chance your
Subject line was no
Is there away to find all of the hostname on a lan with use of perl?
Thanks,
Thomas
Hi -
I just installed perl-5.8.0 from source, in the shell
(perl -MCPAN -e shell) I tried to "install LWP" but
had some problems until I added an *incorrect*
hostname to the 127.0.0.1 line in /etc/hosts
my resolver provides correct reverse dns, how do
I use that? and how do I manual
On Friday, August 2, 2002, at 08:09 , Chad Kellerman wrote:
[..]
> ** I always have issues with scope Can I use Sys::Hostname just in
> the subroutine, or any perl module for that matter? Or do I have to use
> it globally?
>
> $host=hostname; finds that daggone host
Hello,
Ok, I made a newbie mistake and I hope I don't have to go back and
change my code.
I wrote a script that talks to a Mysql database. I created a table
called hostname.
I created a subroutine to send email messages when that is any errors as
well as log them to the db.
Pr
24 matches
Mail list logo