Re: command execution

2006-07-24 Thread Michael Gale
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 exe

command execution

2006-07-24 Thread Sayed, Irfan \(Irfan\)
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.

perl gnome like terminal ?

2006-07-24 Thread Michael Gale
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]

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Dr.Ruud
"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 t

Re: XML::Simple -- can't get anything to print from array

2006-07-24 Thread Mumia W.
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

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Mumia W.
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: perl

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Nishi Bhonsle
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 C:\build\Sample\NewDi

Re: regular expression help

2006-07-24 Thread Jonathan Weber
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 p

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Dr.Ruud
"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 > C:\build\Sample

Re: Term:ReadKey

2006-07-24 Thread Michael Gale
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 m

Re: passing a list as a variable

2006-07-24 Thread D. Bolliger
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; > >>

Re: [OT] Re: Regex find and replace - delete line

2006-07-24 Thread Chad Perrin
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 b

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Nishi Bhonsle
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 C:\build\Sample\

Re: [OT] Re: Regex find and replace - delete line

2006-07-24 Thread Mathew Snyder
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

RE: Regex find and replace - delete line

2006-07-24 Thread Smith, Derek
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ahhh yes...thank you for the pointing out the oversights => qw instead of qq and removing the commas. ___

Re: passing a list as a variable

2006-07-24 Thread Dr.Ruud
"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

Re: regular expression help

2006-07-24 Thread Dr.Ruud
"Jonathan Weber" schreef: > A Title > > 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"). > > $_ =~ /\s*<\/a>\s*(+)<\/h2>/ > > That's my regex, except I'm having trouble with the _ part. N

Re: passing a list as a variable

2006-07-24 Thread Dr.Ruud
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

XML::Simple -- can't get anything to print from array

2006-07-24 Thread brian bwarn
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: --- --- Perl code: # use modules use XML::Simple; use Dat

Re: regular expression help

2006-07-24 Thread Rob Dixon
Jonathan Weber wrote: > > Hi. I have some HTML files with lines like the following: > > A Title > > 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"). > > $_ =~ /\s*<\/a>\s*(+)<\/h2>/ > > That'

Re: Regex find and replace - delete line

2006-07-24 Thread D. Bolliger
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: ""

Re: passing a list as a variable

2006-07-24 Thread D. Bolliger
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 tes

regular expression help

2006-07-24 Thread Jonathan Weber
Hi. I have some HTML files with lines like the following: A Title 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"). $_ =~ /\s*<\/a>\s*(+)<\/h2>/ That's my regex, except I'm having trouble with

Re: passing a list as a variable

2006-07-24 Thread Chris Charley
- Original Message - From: ""Ryan Moszynski"" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: 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 list as a v

RE: Regex find and replace - delete line

2006-07-24 Thread Smith, Derek
-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 wa

Re: Regex find and replace - delete line

2006-07-24 Thread John W. Krahn
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 ( reve

Re: passing a list as a variable

2006-07-24 Thread Dr.Ruud
"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

Re: passing a list as a variable

2006-07-24 Thread Mumia W.
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 comma

Re: passing a list as a variable

2006-07-24 Thread Mumia W.
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"

Re: passing a list as a variable

2006-07-24 Thread D. Bolliger
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

Re: passing a list as a variable

2006-07-24 Thread Ryan Moszynski
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]

Re: passing a list as a variable

2006-07-24 Thread Joshua Colson
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 > pr

Re: MySQL question

2006-07-24 Thread Dave Gray
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 +

Re: passing a list as a variable

2006-07-24 Thread Ryan Moszynski
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 "0..15,33..43,

Re: passing a list as a variable

2006-07-24 Thread Dr.Ruud
"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){ >

RE: passing a list as a variable

2006-07-24 Thread Moon, John
-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 a

Re: passing a list as a variable

2006-07-24 Thread D. Bolliger
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 belo

RE: passing a list as a variable

2006-07-24 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Ryan Moszynski wrote: > 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 =

Re: passing a list as a variable

2006-07-24 Thread Joshua Colson
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 s

passing a list as a variable

2006-07-24 Thread Ryan Moszynski
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";

Re: Regex find and replace - delete line

2006-07-24 Thread Chris Charley
- Original Message - From: ""John W. Krahn"" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: "Perl Beginners" 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 question but

perl execution through vbscript

2006-07-24 Thread Shourya Sengupta
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 the

Re: XML package in perl

2006-07-24 Thread Dr.Ruud
"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

Re: foreach loop

2006-07-24 Thread Dr.Ruud
"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 @v

[OT] Re: Regex find and replace - delete line

2006-07-24 Thread D. Bolliger
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

RE: foreach loop

2006-07-24 Thread Sayed, Irfan \(Irfan\)
Hi All, Following is the code which I am executing. my $fname3 = "/tmp/vob_repl_list_test1"; open(FILE2, $fname3); my @vob_repl_list = ; 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 -ho

Re: Regex find and replace - delete line

2006-07-24 Thread Randal L. Schwartz
> ""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 http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical wri

RE: Error handling on script(closed)

2006-07-24 Thread joseph tacuyan
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) >

XML package in perl

2006-07-24 Thread Shourya Sengupta
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, Shoury