Hi List,
Again I need your help, script in question is here:
#usr/local/perl -w
use strict;
use Socket;
open(OUTPUT,iplisted.txt) or die can't open iplisted.txt $!;
foreach (DATA) {
s/\s+//;
my $address = $_;
my $name = gethostbyaddr(inet_aton($address), AF_INET)
or die Can't
On 7/24/06, joseph tacuyan wrote:
How can rewrite it, so even it encounters such an error it would still
continue? Thank you for all the help.
Change this:
my $name = gethostbyaddr(inet_aton($address), AF_INET)
or die Can't resolve $address: $!\n;
print OUTPUT $_ =$name \n;
to:
my
Hi,
joseph tacuyan [EMAIL PROTECTED] asked:
#usr/local/perl -w
use strict;
use Socket;
open(OUTPUT,iplisted.txt) or die can't open iplisted.txt
$!; foreach (DATA) { s/\s+//; my $address = $_; my $name
= gethostbyaddr(inet_aton($address), AF_INET)
or die Can't resolve
Michael Gale [EMAIL PROTECTED] asked:
I am using Term::ReadKey with the ReadLine function, is
there a way to pass my input to the shell ?
Have a look at system(), and the perlipc manpage.
HTH,
Thomas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] writes:
[EMAIL PROTECTED] wrote:
Hi,
I am a beginner in perl and am having a dickens of a time trying to
identify this pattern in messages. [URL
Here is what I have:
if ($FORM{'message} =~ /\[URL/ig) {
#do something;
}
Where
John W. Krahn wrote:
As you have seen when using Tie::File removing the contents of a line do not
remove that line. You have to splice the tied array:
my $line_to_remove;
for my $i ( 0 .. $#file ) {
$line_to_remove = $i if /foo/;
}
splice @file, $line_to_remove, 1;
If you have more than
In a perl program I am using the XML package.
Now this package has to be copied to the machine where my perl script
resides, before running the script.
I am using ftp to copy the package(file by file using mput command).
Do I have to copy the files in ASCII mode or in binary mode?
Regards,
Thomas B�tzler [EMAIL PROTECTED] wrote: Hi,
joseph tacuyan asked:
#usr/local/perl -w
use strict;
use Socket;
open(OUTPUT,iplisted.txt) or die can't open iplisted.txt
$!; foreach () { s/\s+//; my $address = $_; my $name
= gethostbyaddr(inet_aton($address), AF_INET)
or
D == D Bolliger [EMAIL PROTECTED] writes:
D . . . we have 34 degrees here
34 degrees of what? How many radians is that?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting,
Hi All,
Following is the code which I am executing.
my $fname3 = /tmp/vob_repl_list_test1;
open(FILE2, $fname3);
my @vob_repl_list = FILE2;
close(FILE2);
foreach my $a(@vob_repl_list)
{
`$MT chreplica -host puvob02 $a`;
}
I am not getting the proper value of $a in the command `$MT chreplica
Randal L. Schwartz am Montag, 24. Juli 2006 09:39:
D . . . we have 34 degrees here
34 degrees of what?
Celsius.
I'll include the following disclaimer in further posts:
DISCLAIMER: Please excuse my bad english.
How many radians is that?
Please don't hijack threads with new questions...
Sayed, Irfan (Irfan) schreef:
Following is the code which I am executing.
Missing:
use warnings ;
use strict ;
my $fname3 = /tmp/vob_repl_list_test1;
open(FILE2, $fname3);
Missing: error checking.
open my $fh3, '', $fname3 or die open $fname3, stopped $! ;
my
Shourya Sengupta schreef:
In a perl program I am using the XML package.
Which XML package? Some module?
Now this package has to be copied to the machine where my perl script
resides, before running the script.
I am using ftp to copy the package(file by file using mput command).
Do I have
I am executing a perl script through a vbscript. The vbscript is stored
on a windows machine and the perl script on the unix machine. We are
connecting to the unix machine through a tool whuch we have built(uses
ssh protocol) and executing the perl script.
The command we are using is this :(in
- Original Message -
From: John W. Krahn [EMAIL PROTECTED]
Newsgroups: perl.beginners
To: Perl Beginners beginners@perl.org
Sent: Sunday, July 23, 2006 4:33 PM
Subject: Re: Regex find and replace - delete line
James Turnbull wrote:
Hi all
Hello,
This feels like a really dumb
Is there a way to make my commented 'foreach line act the same as the
line above it?
Can I pass a list as a variable as I am trying to do, or doesn't perl
support that?
###
#!/usr/bin/perl -w
$|=1;
#use strict;
system clear;
my @array = 1024;
my $list4 = 0..10,33..43,100..111;
On Mon, 2006-07-24 at 12:40 -0400, Ryan Moszynski wrote:
Is there a way to make my commented 'foreach line act the same as the
line above it?
Sure.
Can I pass a list as a variable as I am trying to do, or doesn't perl
support that?
###
#!/usr/bin/perl -w
$|=1;
#use strict;
Ryan Moszynski am Montag, 24. Juli 2006 18:40:
Is there a way to make my commented 'foreach line act the same as the
line above it?
Yes!
DISCLAIMER: Please excuse my bad english
Can I pass a list as a variable as I am trying to do, or doesn't perl
support that?
You can, but... see below.
-Original Message-
From: Ryan Moszynski [mailto:[EMAIL PROTECTED]
Sent: Monday, July 24, 2006 12:41 PM
To: beginners@perl.org
Subject: passing a list as a variable
Is there a way to make my commented 'foreach line act the same as the
line above it?
Can I pass a list as a variable as I
Ryan Moszynski schreef:
Can I pass a list as a variable as I am trying to do, or doesn't perl
support that?
###
#!/usr/bin/perl -w
$|=1;
#use strict;
system clear;
my @array = 1024;
my $list4 = 0..10,33..43,100..111;
foreach (0..10,33..43,100..111){
#foreach
thanks, that works, but it won't solve my problem.
I'm writing a program where the user enters a list through the keyboard, like:
0..10,33..43,100..111
I would like to pass this list directly into a foreach function. The
problem is, when i pass my scalar in, i get:
###
Argument
On 7/21/06, Karjala [EMAIL PROTECTED] wrote:
Maybe I should ask this question on a database list, but it's related to
DBI, so I'm asking here also:
I have a field in a record in the MySQL database that contains a number.
I increase it by one with $dbh-do(update table set myfield = myfield +
1
On Mon, 2006-07-24 at 13:13 -0400, Ryan Moszynski wrote:
thanks, that works, but it won't solve my problem.
I'm writing a program where the user enters a list through the keyboard, like:
0..10,33..43,100..111
I would like to pass this list directly into a foreach function. The
problem
thanks guys. Dr. Ruud's solution does the trick. I was trying to get
around having to do that, but i guess you can't have everything.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
Joshua Colson am Montag, 24. Juli 2006 19:32:
On Mon, 2006-07-24 at 13:13 -0400, Ryan Moszynski wrote:
thanks, that works, but it won't solve my problem.
I'm writing a program where the user enters a list through the keyboard,
like: 0..10,33..43,100..111
I would like to pass this list
On 07/24/2006 11:40 AM, Ryan Moszynski wrote:
Is there a way to make my commented 'foreach line act the same as the
line above it?
[...]
foreach (0..10,33..43,100..111){
#foreach ($list4){
[...]
Use the split function to split $list4 on the commas. Read
about split: perldoc -f split
On 07/24/2006 12:12 PM, Mumia W. wrote:
On 07/24/2006 11:40 AM, Ryan Moszynski wrote:
Is there a way to make my commented 'foreach line act the same as the
line above it?
[...]
foreach (0..10,33..43,100..111){
#foreach ($list4){
[...]
Use the split function to split $list4 on the
D. Bolliger schreef:
# input sanitizing
#
my $re_range=qr/\d+\s*\.\.\s*\d+/;
$user_input=~/^\s*$re_range(?:\s*,\s*$re_range)*\s*$/
or die 'invalid input!';
my @list4=eval $user_input;
An embedded newline can fool that test.
You can make it much stricter,
by replacing the \s by
Chris Charley wrote:
- Original Message - From: John W. Krahn [EMAIL PROTECTED]
And if you want to do it with one loop:
for my $i ( reverse 0 .. $#file ) {
splice @file, $i, 1 if /foo/;
}
Hi John
Shouldn't the above read like:
for my $i ( reverse 0 .. $#file ) {
-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]
Sent: Monday, July 24, 2006 3:36 PM
To: Perl Beginners
Subject: Re: Regex find and replace - delete line
Chris Charley wrote:
- Original Message - From: John W. Krahn
[EMAIL PROTECTED]
And if you want to do it
- Original Message -
From: Ryan Moszynski [EMAIL PROTECTED]
Newsgroups: perl.beginners
To: beginners@perl.org
Sent: Monday, July 24, 2006 12:40 PM
Subject: passing a list as a variable
Is there a way to make my commented 'foreach line act the same as the
line above it?
Can I pass a
Hi. I have some HTML files with lines like the following:
a name=w12234 /a h2A Title/h2
I'm using a regular expression to find these and capture the name
attribute (w12234 in the example) and the contents of the h2 tag (A
Title).
$_ =~ /a name=(w\d+)\s*\/a\s*h2(+)\/h2/
That's my regex,
Dr.Ruud am Montag, 24. Juli 2006 20:54:
D. Bolliger schreef:
# input sanitizing
#
my $re_range=qr/\d+\s*\.\.\s*\d+/;
$user_input=~/^\s*$re_range(?:\s*,\s*$re_range)*\s*$/
or die 'invalid input!';
my @list4=eval $user_input;
An embedded newline can fool that test.
You can make
Smith, Derek am Montag, 24. Juli 2006 22:03:
-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]
Sent: Monday, July 24, 2006 3:36 PM
To: Perl Beginners
Subject: Re: Regex find and replace - delete line
Chris Charley wrote:
- Original Message - From: John W.
Jonathan Weber wrote:
Hi. I have some HTML files with lines like the following:
a name=w12234 /a h2A Title/h2
I'm using a regular expression to find these and capture the name
attribute (w12234 in the example) and the contents of the h2 tag (A
Title).
$_ =~ /a
I'm just starting out with XML::Simple and can't get
any output to display to STDOUT. What am I missing?
---
Source XML snippet:
---
dataschemas
dataschema name=defaultDB
includes
include name=Base Metadata/
include name=Extracted Re-Map/
D. Bolliger:
Dr.Ruud:
D. Bolliger:
# input sanitizing
#
my $re_range=qr/\d+\s*\.\.\s*\d+/;
$user_input=~/^\s*$re_range(?:\s*,\s*$re_range)*\s*$/
or die 'invalid input!';
my @list4=eval $user_input;
An embedded newline can fool that test.
You can make it much stricter,
by replacing
Jonathan Weber schreef:
a name=w12234 /a h2A Title/h2
I'm using a regular expression to find these and capture the name
attribute (w12234 in the example) and the contents of the h2 tag (A
Title).
$_ =~ /a name=(w\d+)\s*\/a\s*h2(+)\/h2/
That's my regex, except I'm having trouble with
Chris Charley schreef:
Ryan Moszynski:
Can I pass a list as a variable as I am trying to do, or doesn't perl
support that?
Just another way to do it using Set::IntSpan :-)
I was trying to find a recent thread on the same issue, and now I found
it, because I remembered that IntSpan was
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
Ahhh yes...thank you for the pointing out the oversights = qw instead
of qq and removing the commas.
Please lighten up.
Mathew Snyder
D. Bolliger wrote:
Randal L. Schwartz am Montag, 24. Juli 2006 09:39:
D . . . we have 34 degrees here
34 degrees of what?
Celsius.
I'll include the following disclaimer in further posts:
DISCLAIMER: Please excuse my bad english.
How many radians is
Hi:
If I need to get the files without the . and the .. at the first level
only, then how can i modify the find command?
ie
Currently using find(sub {push(@new,$_) if ( -f ) }, $path); gives me all
files under NewDir as well as NewSubDirectory
C:\build\Sample\NewDir\File1.txt
On Mon, Jul 24, 2006 at 07:35:03PM -0400, Mathew Snyder wrote:
Please lighten up.
How many lumens is that?
(Please don't top-post.)
--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
There comes a time in the history of any project when it becomes necessary
to shoot the engineers and
Dr.Ruud am Dienstag, 25. Juli 2006 00:34:
D. Bolliger:
Dr.Ruud:
D. Bolliger:
# input sanitizing
#
my $re_range=qr/\d+\s*\.\.\s*\d+/;
$user_input=~/^\s*$re_range(?:\s*,\s*$re_range)*\s*$/
or die 'invalid input!';
my @list4=eval $user_input;
An embedded newline can fool that
Hello,
This will not work as my system will block on the command until it is
done. I want / need the script to continue catching the input.
Michael
Thomas Bätzler wrote:
Michael Gale [EMAIL PROTECTED] asked:
I am using Term::ReadKey with the ReadLine function, is
there a way to pass my
Nishi Bhonsle schreef:
If I need to get the files without the . and the .. at the first
level only, then how can i modify the find command?
ie
Currently using find(sub {push(@new,$_) if ( -f ) }, $path); gives
me all files under NewDir as well as NewSubDirectory
On 24 Jul 2006, at 5:48 PM, Rob Dixon wrote:
- The character wildcard '.' is just a dot within a character
class, so [.\n]
will match only a dot or a newline
Ah, I hadn't realized that characters in [ ] are literals. That
clears up a lot of the problem.
- Regexes aren't the best way of
Hi:
I am not able to get the files at just the first level.
ie
print $_\n for $io-all(0); prints all level down
and
print $_\n for $io-all(1); prints the files and the dir name at the
first level
ie
issuing the command for path C:\build\Sample\NewDir
prints the below
On 07/24/2006 06:35 PM, Nishi Bhonsle wrote:
Hi:
If I need to get the files without the . and the .. at the first level
only, [...]
use File::Slurp;
my @files = read_dir('mydirectory');
Do you have the perl documentation installed?
This should give you information about File::Slurp:
perldoc
On 07/24/2006 04:59 PM, brian bwarn wrote:
I'm just starting out with XML::Simple and can't get
any output to display to STDOUT. What am I missing?
---
Source XML snippet:
---
[snipped]
Use the ForceArray option to make traversal easier. Use
Data::Dumper to
Nishi Bhonsle schreef:
I am not able to get the files at just the first level.
ie
print $_\n for $io-all(0); prints all level down
and
print $_\n for $io-all(1); prints the files and the dir name at
the first level
All and all(0) are the same.
all and all(1) are the same.
Try
Hello,
I am interested in creating a perl gnome like terminal, would
IPC::Open3 be the best thing to use to pass the input and output from my
text window to the underlining shell ?
Michael
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi All,
I am executing following command
` $MT chreplica`;
I need to find out wheather this command is executing properly or not.
If it's executing properly then i need to print the message saying that
command executed successfully
Can anybody please help me.
Regards
Irfan.
What about:
my $cmd = ls -l;
system($cmd) == 0 or error_msg(Could not run command);
Where error_msg is a function that takes a argument.
Michael
Sayed, Irfan (Irfan) wrote:
Hi All,
I am executing following command
` $MT chreplica`;
I need to find out wheather this command is
54 matches
Mail list logo