Jason Cruces wrote:
>
> Hello all,
> Probably are really simple one but haven't found the
> answer yet. In an interactive program, where a user is
> prompted to enter more than one value, I would use
>
> chomp(@values = );
>
> And to terminate the input, enter Ctrl-D (or Ctrl-Z on
> windows).
>
Nathaniel Wert wrote:
>
> I am trying to make a feable attempt at parsing a nslookup call. All I actually
>want is the IP address. So I figured I would do the following:
>
> $ticker = 0;
> foreach $_ (`nslookup $nodename`) {
> $_ = $out[$ticker];
> $ticker++;
> }
>
> print $out[0];
>
>
Uncertain what you are attempting to do, but:
#!perl -w
while ( ) {
chomp;
if ( /^(\d+\.\d+.\d+\.\d+)/ ) { #Extact the IP address here and stote as $1
print "$1\n";
}
}
__DATA__
192.168.0.2
This should not print
199.88.22.111
^ Script ends here
Output:
192.168.0.2
199
Hello Perl Experts;
I'm new to creating references.
How do I create a small script that replaces "C" with "D" using a reference
only to the array element location for
"C"?
#!/usr/bin/perl -w
@letters=("A", "B", "C");
Best Rgds
JA
--
To unsubscribe, e-mail: [EMAIL PRO
G'day All,
I have this very very simple problem that I can't figure out. Basically
I have a 1 line text file with an IP address in it like so...
192.168.0.2
Now all I want to do is open this file up and extract the IP address
from it. Now the good thing is I can do this OK but whenever I extr
On Friday 02 November 2001 05:18 pm, you wrote:
> Unsure what you are trying, but:
>
> if ( /^T...A/ ) { # When try
> # if Starts with a T , dont care about 2 thru 4 and the 5th char
> is A }else {
> # not a hit do work here
>}
>
> Wags ;)
Great commenting style.
Hi Wags,
Thanks a lot for your help. It worked great.
Henry
On Fri, 2 Nov 2001, Wagner-David wrote:
> Unsure what you are trying, but:
>
> if ( /^T...A/ ) { # When try
> # if Starts with a T , dont care about 2 thru 4 and the 5th char is A
>}else {
> # no
Unsure what you are trying, but:
if ( /^T...A/ ) { # When try
# if Starts with a T , dont care about 2 thru 4 and the 5th char is A
}else {
# not a hit do work here
}
Wags ;)
-Original Message-
From: Henry Hung-Yung Wang [mailt
What version of IIS are you running? For 4.0 and above:
When you install Activestate - it automatically 'associates' .pl with the
PERL interpreter and .plx to use PERL for ASAPI - meaning you can use PERL
in your ASP pages - just make sure you call them xxx.plx and call them as
such from within
Hi perl masters,
I am a very "beginner" of perl and I have a very simple question. I want
to match characters within a sting of letters.
ex: TCATATTG
I want to match character 1 to "T" and character 5 to "A" how would I go
about doing that? Thanks so much for your help.
Henry
--
To unsubscr
On Nov 2, Paul Johnson said:
>{ my $a = "foo"; sub foo { sub { $a } } }
>{ my $a = "bar"; sub bar { $a; sub { $a } } }
Man, that still exists? Grumble. I ran into that a year or two ago. I
would have thought Perl 5.6 would have cleaned that out.
--
Jeff "japhy" Pinyan [EMAIL PROTEC
Hello Jason,
Saturday, November 03, 2001, Jason Cruces <[EMAIL PROTECTED]> wrote:
JC> Hello all,
JC> Probably are really simple one but haven't found the
JC> answer yet. In an interactive program, where a user is
JC> prompted to enter more than one value, I would use
JC> chomp(@values = );
JC>
On Fri, Nov 02, 2001 at 05:18:37PM -0500, Wert, Nathaniel wrote:
> $nodename = ;
chomp $nodename;
> $iaddr = gethostbyname($nodename);
> ($a,$b,$c,$d) = unpack('C4',$iaddr);
> $ipaddress = "$a.$b.$c.$d";
> print $ipaddress;
>
> I have debugged this numerous times and I can't seem to understand
I just realized I was not chomping . Thanks.
-Original Message-
From: Wert, Nathaniel
Sent: Friday, November 02, 2001 5:19 PM
To: 'Maxim Berlin'
Cc: '[EMAIL PROTECTED]'
Subject: RE: gethostbyname and getnetbyname
Maybe it comes in the statement before that:
$nodename = ;
$iaddr = get
Hello Nathaniel,
Saturday, November 03, 2001, Wert, Nathaniel <[EMAIL PROTECTED]> wrote:
WN> Maybe it comes in the statement before that:
WN> $nodename = ;
:) you forgot
chomp $nodename;
here. $nodename contains '\n' at the end.
WN> $iaddr = gethostbyname($nodename);
WN> ($a,$b,$c,$d) = unpack
Just some minor changes to allow no input to terminate your processing. This
will terminate when only enter is depressed.
#!perl -w
my $i=-1;
my @value = ();
do{
chomp($value[++$i] = );
}until (! $value[$i]);
# print the input
foreach ( @value ) {
print "$_\n";
}
Wags ;)
-Ori
Maybe it comes in the statement before that:
$nodename = ;
$iaddr = gethostbyname($nodename);
($a,$b,$c,$d) = unpack('C4',$iaddr);
$ipaddress = "$a.$b.$c.$d";
print $ipaddress;
I have debugged this numerous times and I can't seem to understand why gethostbyname
does not return anything. I have
Hello all,
Probably are really simple one but haven't found the
answer yet. In an interactive program, where a user is
prompted to enter more than one value, I would use
chomp(@values = );
And to terminate the input, enter Ctrl-D (or Ctrl-Z on
windows).
My question is, how would I change the ter
Hello Nathaniel,
Friday, November 02, 2001, Wert, Nathaniel <[EMAIL PROTECTED]> wrote:
WN> 1) I can get gethostbyname to work in this format:
WN> gethostbyname('node.foo.com'). I need it to work in the following
WN> format: gethostbyname($nodename). Is this not set up for that?
On Fri, Nov 02, 2001 at 03:41:02PM -0500, Jeff 'japhy' Pinyan wrote:
> On Nov 2, Paul Johnson said:
>
> >3. Currently, Perl exhibits some surprising behaviour in certain
> >situations when a named subroutine is being used as a closure. In
> >practice, Perl does not properly close named
Thanks! Duh!
on to the next set of errors..
-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 4:12 PM
To: Wright, Thomas
Cc: [EMAIL PROTECTED]
Subject: Re: problems with eof and variable
On Nov 2, Wright, Thomas said:
>Hi folk
hi
i wanna know how i could finish a thread that i've just detach.
is there a finish or kill like command ?
thx a lot
sam
--
...
| sam <°)(°> mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..___
On Nov 2, Wright, Thomas said:
>Hi folks,
>
>Be gentle, this is my very first Perl program, and it is basically a batch
>file processing task, nothing fancy.
>I know it is not the most efficient, but I want to keep it as simple and
>clear as possible. Once I get it working, I can make it tighter
Hi folks,
Be gentle, this is my very first Perl program, and it is basically a batch
file processing task, nothing fancy.
I know it is not the most efficient, but I want to keep it as simple and
clear as possible. Once I get it working, I can make it tighter.
I am getting 2 or 3 errors, though
On Nov 2, Paul Johnson said:
>> can be called a closure. I feel that "closure" refers more to the action,
>> and less to the means -- we are creating a subroutine (named or unnamed
>> makes no difference) which holds on to variables that "should" be gone.
First, I have to thank you for taking t
On Fri, Nov 02, 2001 at 10:51:49AM -0500, Jeff 'japhy' Pinyan wrote:
> On Nov 2, Etienne Marcotte said:
>
> >check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
> >
> >a really good document on closures...
>
> Before I get a barrage of "BUT THAT'S NOT A CLOSURE!" let me say this. I
On Nov 2, Mike Gargiullo said:
>OK I know Perl is the language that lets you do things several different
>ways. So with that having been said, how can I convert the while
>statement into a subroutine and pas the filehandles to it ?
I'd make a function that takes two filenames, and does the work.
Well, suppose my C program does this:
$ ./cprogram
First Name: Pete
Last Name: Emerson
I could use a Perl program like this to analyse the output:
The key is that the backticks execute any executable file and store the
output.
#!/usr/bin/perl -w
use strict;
my $cstuff=`./cprogram`;
my $first
Thank you for the help earlier, but I am still having a problem.
1) I can get gethostbyname to work in this format: gethostbyname('node.foo.com'). I
need it to work in the following format: gethostbyname($nodename). Is this not set
up for that?
2) I tried to alternatively use getnetbyname,
hello,
Thanks. For the info. Now, how about if I want to get a return value
from the called c or perl program?
On Fri, 2 Nov 2001, Pete Emerson wrote:
> Yes, you can do it. Here's four files. First, Perl calling a C program:
>
> chelloworld.c gcc -o chelloworld chelloworld.c
>
> #
Yes, you can do it. Here's four files. First, Perl calling a C program:
chelloworld.c gcc -o chelloworld chelloworld.c
#include
int main() {
printf("Hello, World, in C!\n");
return;
}
perlprinter.pl ##
#!/usr/bin/perl
system("./chelloworld");
Now C calling a Perl pro
> The overall problem is not if grep works or not, but why the
> output from the backticks does not show up in the cgi. I only put
> the grep in there to make the code read easier. $results does not
> have anything in the cgi with or without the grep. Below is the code
> again. Am I not
hi,
How do I imed a c program in a perl script. For example I would like
to have a perl script call a "hello world" executable file what was
compiled in unix.
Can I do the reverse? IE have a C program call a perl script that just
prints "hello world".
I don't have a specific problem to solve.
something like this
#
# Nothing special .. just opening the file handles
#
open(ONE,"one.dat") or die $!,"\n";
open(TWO,"two.dat") or die $!,"\n";
open(THREE,"three.dat") or die $!,"\n";
#
# sending the file handle into a reference as a glob
# you could also do thi
There are a couple of very strange things with your questions and code ..
firstly you dont need to put the $_ in the foreach line ... if you dont put
anything there then it will pull the value into $_ on each iteration
secondly your question that $_ was an array is clearly wrong ... $_ can only
be
OK I know Perl is the language that lets you do things several different
ways. So with that having been said, how can I convert the while
statement into a subroutine and pas the filehandles to it ?
#!/usr/bin/perl -w
$tiernum = shift or die "usage: tier2 [3,6,8] [1,2] directory-name id
$!\n";
$st
Hello Robert,
Friday, November 02, 2001, Robert Thompson <[EMAIL PROTECTED]> wrote:
RT> The overall problem is not if grep works or not, but why the
RT> output from the backticks does not show up in the cgi. I only put
RT> the grep in there to make the code read easier. $results does not
Not sure if i am out of line here but shouldnt it be
$out[$ticker] = $_ ;
instead of
$_ = $out[$ticker];
On Fri, Nov 02, 2001 at 11:05:09AM -0500, Wert, Nathaniel shaped the electrons to read:
> I am trying to make a feable attempt at parsing a nslookup call. All I actually
>want i
I am trying to make a feable attempt at parsing a nslookup call. All I actually want
is the IP address. So I figured I would do the following:
$ticker = 0;
foreach $_ (`nslookup $nodename`) {
$_ = $out[$ticker];
$ticker++;
}
print $out[0];
I am getting a uninitalized error for $out[0].
I'm writing a cgi script that connects to an access DB in windows using
DBD::ODBC.
the program works great from the command line, but when I try to run it
from the browser, this is what I get
DBI->connect(mycddb) failed: [Microsoft][ODBC Driver Manager] Data source
name not found and no defau
hello
i wanna know if it was possible to catching output in detached threads.
thx a lot
sam
--
...
| sam <°)(°> mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..__\_/\_/_
On Nov 2, Etienne Marcotte said:
>check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
>
>a really good document on closures...
Before I get a barrage of "BUT THAT'S NOT A CLOSURE!" let me say this. I
was told that by someone (can't remember who), and I asked merlyn (Randal)
what he
check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
a really good document on closures...
Etienne
Jenda Krynicky wrote:
> Original suggestion (comments stripped):
> > {
> > my $savedData = 0;
> >
> > sub rememberData
> > {
> > $savedData = shift if @_;# upda
On Nov 2, eventualdeath said:
>Statement 1 :-
>@read = join ('\n', split(//, @read));
Well, you don't want to use join() here. join() takes a LIST and returns
a STRING. If you use it, your array will have ONE element. That doesn't
sound terribly useful. (And you've got '\n' where you probabl
Hi,
I am trying to install Perl 5.6.1 and having problems while doing make. Any
idea why I am getting this error? What should I do to get rid of this?
>make
`sh cflags libperl.a pp_sys.o` pp_sys.c
CCCMD = gcc -DPERL_CORE -c -D_ALL_SOURCE -D_ANSI_C_SOURCE
-D_POSIX_SOURCE -fno
On 2 November 2001 12:20, Daryoush Ashtari [mailto:[EMAIL PROTECTED]] wrote:
> Can some one tell me how I can find a substring in specific field of
> records of a database in PostgreSQL with Perl?
I would suggest substring, either in SQL (SUBSTRING(field FROM start FOR
char-count)), or, having
Hi
Can some one tell me how I can find a substring in specific field of
records of a database in PostgreSQL with Perl?
Thanks
Daryoush
___
The coolest freemail you have ever seen
12MB of space, filters, folders, fast!
--- http://zapo.net Free email-
On 1 November 2001 22:17, shalini Raghavan
[mailto:[EMAIL PROTECTED]] wrote:
> Thank you for the help.I've been trying to use a script that uses the
> map function in the following manner
> my $var = chr(13); for the control character ^M
> my @mapped = map{
> s/$var//g;
>
hi there. i'm new on this mailing list. i've started programming perl a
very few weeks ago and i'm no confronted to threads. i've read the (very
good) article about thread on use Perl; web site, installed the
perl-5.005-thread package, and changed the line :
#!/usr/bin/perl -w
to
#!/usr/bin/perl-t
Hi
The script below does not do what I want which is to search a guestbook for
a particular word and if that word appear, to show the records. Currently,
after the script is run, it returns a blank page. I've confirmed that the
fault lies with statement 1, in other words, if I replace statement1
50 matches
Mail list logo