Re: grep with [ ] brackets ... ?

2003-09-22 Thread John W. Krahn
Luke Bakken wrote: > > I'd thought I'd seen everything with perl until I saw John Krahn give > this code as a solution: > > #syntax: unfold.pl filename > newfilename > > @ARGV or die "usage: $0 filename\n"; > $/ = ''; > print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>; It's just a differe

Re: Silly question

2003-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Gupta, Sharad said: > package Foo; > use overload q("") => sub {return shift->{bar}}; > $s = bless{bar=>"hello"}, Foo; > print "$s\n" > >prints "hello". Because you have overloaded "" for objects of class Foo. > pac

Re: grep with [ ] brackets ... ?

2003-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Bakken, Luke said: >$/ = ''; print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>; > >I've never seen grep used with [ ] brackets before - it works the same >with { }: > >print for grep { chomp, s/\n\s+/ /g, s/\z/\n\n/ } <>; Not really. Here's an example: print grep [ rand(2) < 1

Silly question

2003-09-22 Thread Gupta, Sharad
Hi ALL, I know i am missing something somewhere: perl -e ' package Foo; use overload q("") => sub {return shift->{bar}}; $s = bless{bar=>"hello"}, Foo; print "$s\n" ' prints "hello". Whereas: perl -e '

grep with [ ] brackets ... ?

2003-09-22 Thread Bakken, Luke
I'd thought I'd seen everything with perl until I saw John Krahn give this code as a solution: #syntax: unfold.pl filename > newfilename @ARGV or die "usage: $0 filename\n"; $/ = ''; print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>; I've never seen grep used with [ ] brackets before - it

Re: Problem with input record separator

2003-09-22 Thread Paul Johnson
On Mon, Sep 22, 2003 at 10:29:14PM +0100, Rob Dixon wrote: > Daniel Liston wrote: > > > > John W. Krahn wrote: > > > > > Or you could pare that down a bit. :-) > > > > > > #!/usr/bin/perl > > > > > > #syntax: unfold.pl filename > newfilename > > > > > > @ARGV or die "usage: $0 filename\n"; > > >

Re: perl(this) and perl(the)

2003-09-22 Thread Wiggins d'Anconia
On Mon, 22 Sep 2003 22:47:16 +0100, "Rob Dixon" <[EMAIL PROTECTED]> wrote: > Daniel Staal wrote: > > > > --On Monday, September 22, 2003 19:23 +0100 Rob Dixon > > <[EMAIL PROTECTED]> wrote: > > > > > I'm playing away here, as I know nothing about R

Graph package internal method _edges()

2003-09-22 Thread Ying Liu
Hello, I can't use a method called edges($u, $v) in the Graph::Base package. It will use an internal method _edges defined in Graph::Directed package. Even I copy this _edges() from Directed package to the Base package, I still can't use it, The program freezed when I use '@e = $G->edges;'. I

Re: perl(this) and perl(the)

2003-09-22 Thread Rob Dixon
Daniel Staal wrote: > > --On Monday, September 22, 2003 19:23 +0100 Rob Dixon > <[EMAIL PROTECTED]> wrote: > > > I'm playing away here, as I know nothing about RPM other than > > that it is a package manager and pro9bably specific to RedHat > > Linux. > > > > Having said that, it looks like you are

Re: Problem with input record separator

2003-09-22 Thread Rob Dixon
Daniel Liston wrote: > > John W. Krahn wrote: > > > Or you could pare that down a bit. :-) > > > > #!/usr/bin/perl > > > > #syntax: unfold.pl filename > newfilename > > > > @ARGV or die "usage: $0 filename\n"; > > > > $/ = ''; print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>; > > I like that

Re: stop/start

2003-09-22 Thread Stephen Hardisty
> $SIG{ALRM} = { > `this-script`; > exit; > }; Sorry, didn't think it through (before anybody notices.). Remove the thing that executes the script (the bit in backticks) and just have the process start on a cron job. Tired, apologies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

Re: stop/start

2003-09-22 Thread Stephen Hardisty
Hi, you could write a handler for the signal alarm that starts a new process and kills the current: $SIG{ALRM} = { `this-script`; exit; }; At the beginning of the script set the alarm to go off 24 hours later: alarm(84600); DISCLAIMER: haven't really thought it through and it's really hac

Re: Problem with input record separator

2003-09-22 Thread Daniel Liston
Daniel Liston wrote: Here is a tool I use to unfold long lines in LDAP outputs. It also works on mailboxes that have the Received: lines or Content-*: lines folded. There are two things in your code that may cause a problem. #!/usr/bin/perl #syntax: unfold.pl filename > newfilename if ($AR

Re: stop/start

2003-09-22 Thread John W. Krahn
Rmck wrote: > > Hi Hello, > I'm trying to get this to work in perl. Which version of Perl? > I want to start a unix process send it to a log file. Then at midnight > kill it and restart it, with the date at the top. Why do you need to kill and restart it? Can't you just print the date at mid

Re: Help needed on Telnet.pm

2003-09-22 Thread Jeff Westman
There is an errmode() and dump_log(). Maybe that is what you are trying to capture. perldoc Net::Telnet -Jeff --- Daniel Staal <[EMAIL PROTECTED]> wrote: > > > --On Tuesday, September 23, 2003 0:02 +0530 Pandey Rajeev-A19514 > <[EMAIL PROTECTED]> wrote: > > > Does Telnet.pm capture ou

Re: Help needed on Telnet.pm

2003-09-22 Thread Daniel Staal
--On Tuesday, September 23, 2003 0:02 +0530 Pandey Rajeev-A19514 <[EMAIL PROTECTED]> wrote: Does Telnet.pm capture output from other than the STDOUT ? I have a case where I telnet to a router through a console connection. All commands work well and returns the output. But, there is a special

Re: perl(this) and perl(the)

2003-09-22 Thread Daniel Staal
--On Monday, September 22, 2003 19:23 +0100 Rob Dixon <[EMAIL PROTECTED]> wrote: I'm playing away here, as I know nothing about RPM other than that it is a package manager and pro9bably specific to RedHat Linux. Having said that, it looks like you are trying to install a module called MySQL::clie

RE: Looking for a good OpenSSL/Perl library

2003-09-22 Thread Rajesh Dorairajan
Well, I looked at this library. But I'm afraid this won't serve the purpose I've in mind. The specific needs I'm looking for are: * Parse a certificate and return it's details (Such as DN, Issuer) * Verify a certificate's integrity * get a PEM encoded certificate from a DER-encoded and vice-versa

Help needed on Telnet.pm

2003-09-22 Thread Pandey Rajeev-A19514
Hi, I need an urgent help and direction regarding capture of scrolling text using the Telnet.pm module. Apart from the False Telnet servers(unusual ascii characters) described in the module, ther is one more scenario where the output on a telnet session shell does not get captured. Does Tel

Re: perl(this) and perl(the)

2003-09-22 Thread Rob Dixon
Rob Dixon wrote: > .. you should use the Database Independent interface module > 'DBI' together with the MySQL driver module 'DBD::MySQL', with > which most Perl database programmers are familiar. Strictly, that should be 'DBD::mysql'. /R -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

Re: perl(this) and perl(the)

2003-09-22 Thread Rob Dixon
Eric Rose wrote: > > This is the error message that I get when installing Mysql. > > #rpm -Uvh MySQL-client-4.0.15-0.i386.rpm > error: Failed dependencies: > perl(the) is needed by MySQL-client-4.0.15-0.i386.rpm I'm playing away here, as I know nothing about RPM other than that it is

Re: nested anonymous reference syntax

2003-09-22 Thread david
[EMAIL PROTECTED] wrote: > Hello, > > I'm having trouble grasping the syntax to perform foreach operation on an > anonymous array within an anonymous hash reference. > > my $hashRef = { bah => "humbug", >list => [ "lions", "tigers", "bears", "oh_my" ], >woo => "hoo" }; here you have a h

stop/start

2003-09-22 Thread rmck
Hi I'm trying to get this to work in perl. I want to start a unix process send it to a log file. Then at midnight kill it and restart it, with the date at the top. I'm starting with the following but the intial start of the proccess is not working right: #!/bin/perl $date = `date | awk '{pri

Re: May I know the perl version of following shellscript

2003-09-22 Thread John W. Krahn
Saifuddin Bohra/Hss wrote: > > Hi, Hello, > I am new to Perl. I have a follpwing shell script > > if [ -n "`netstat -na|grep LISTEN |grep 1099`" ]; > then > exit 0 > else > exit 1 > fi > > I need the perl script for the same job. > and how to use this in another perl prog

Re: Problem with input record separator

2003-09-22 Thread John W. Krahn
Rob Dixon wrote: > > John W. Krahn wrote: > > > > my @records = do { > >local ( $/, *FILE ) = ''; > >open FILE, $ARGV[0] or die "can't open $ARGV[0]: $!"; > >grep chomp, ; > > This will drop the last line of the file if there is no > terminating separator. > > grep {chomp, 1} ; Or

RE: Perl Vs ...

2003-09-22 Thread Akens, Anthony
I first learned C, then C++, which was a good route for me. It gave me a solid background in programming and structure that lends itself well to learning other languages. I've begun to pick up perl in order to aid in system administration, though I've been told that Python is a great tool for tha

Re: OT: RE: Apache Question

2003-09-22 Thread Ebaad Ahmed
I'm sorry to post a unrelated question on the list, but I was hoping somebody will have some kind of answer for me since most of the people on the list have their own sites and email addresses. Really sorry to ask a question like that. Ebaad. --- Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > >

Re: Perl Vs ...

2003-09-22 Thread Dan Anderson
> How do you go about deciding if you > should use another tool such as C++ over perl? You basically look at the advantages and disadvantages of different languages and decide which will be best for the task. For instance, if you wanted to write a quick script to generate a Template file and fil

Re: Perl Vs ...

2003-09-22 Thread Shlomi Fish
On Sun, 21 Sep 2003, Paul Kraus wrote: > Perl was pretty much my first language. Not counting Business Basic and same > old Pascal from high school. The more I learn the more I see that perl can > handle just about anything I want to do. How do you go about deciding if you > should use another too

Re: May I know the perl version of following shellscript

2003-09-22 Thread Jeff Westman
--- Saifuddin_Bohra/[EMAIL PROTECTED] wrote: > > Hi, > I am new to Perl. I have a follpwing shell script > > if [ -n "`netstat -na|grep LISTEN |grep 1099`" ]; > then > exit 0 > else > exit 1 > fi > > I need the perl script for the same job. > and how to use this in another

OT: RE: Apache Question

2003-09-22 Thread Wiggins d'Anconia
On Sun, 21 Sep 2003 22:39:30 -0700 (PDT), Ebaad Ahmed <[EMAIL PROTECTED]> wrote: > Hi, > > I want to configure apache to host my own website on a > solaris box. Please let me know how can I do it, I > have read the FM but could not be confident en

May I know the perl version of following shellscript

2003-09-22 Thread Saifuddin_Bohra/HSS
Hi, I am new to Perl. I have a follpwing shell script if [ -n "`netstat -na|grep LISTEN |grep 1099`" ]; then exit 0 else exit 1 fi I need the perl script for the same job. and how to use this in another perl program Any pointer ?? saifuddin -- To unsubscribe, e-mail:

Re: Printing Arrays

2003-09-22 Thread Rob Dixon
Jenda Krynicky wrote: > > Desmond Lim wrote: > > > I have 3 arrays @arr1, @arr2 and @arr3. > > Do not do that! Yeah. I guess that summarises it :) Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Printing Arrays

2003-09-22 Thread Jenda Krynicky
From: "Desmond Lim" <[EMAIL PROTECTED]> > I have 3 arrays @arr1, @arr2 and @arr3. Do not do that! http://www.oreillynet.com/pub/a/network/2001/05/18/perl_redflags.html Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to

Re: Problem with input record separator

2003-09-22 Thread Rob Dixon
John W. Krahn wrote: > > Daniel Liston wrote: > > > > Here is a tool I use to unfold long lines in LDAP outputs. > > It also works on mailboxes that have the Received: lines > > or Content-*: lines folded. > > There are two things in your code that may cause a problem. > > > > #!/usr/bin/perl > >

RE: Printing Arrays

2003-09-22 Thread Charles K. Clarkson
Desmond Lim <[EMAIL PROTECTED]> wrote: : : I have 3 arrays @arr1, @arr2 and @arr3. : : I need to print them into the same file and I'm doing this. : : open FILE, ; : print FILE "@arr1\n"; : print FILE "@arr2\n"; : print FILE "@arr3\n"; : close FILE; : : I would like to shorten it to : : for ($

Re: Printing Arrays

2003-09-22 Thread Rob Dixon
Desmond Lim wrote: > > I have 3 arrays @arr1, @arr2 and @arr3. > > I need to print them into the same file and I'm doing this. > > open FILE, ; > print FILE "@arr1\n"; > print FILE "@arr2\n"; > print FILE "@arr3\n"; > close FILE; > > I would like to shorten it to > > for ($i=0;$i<4;$i++) { > prin

Printing Arrays

2003-09-22 Thread Desmond Lim
I have 3 arrays @arr1, @arr2 and @arr3. I need to print them into the same file and I'm doing this. open FILE, ; print FILE "@arr1\n"; print FILE "@arr2\n"; print FILE "@arr3\n"; close FILE; I would like to shorten it to for ($i=0;$i<4;$i++) { print FILE "@arr$i\n"; } I know there is an erro

RE: Split based on length

2003-09-22 Thread NYIMI Jose (BMB)
I don't know which version of perl are you using but I have just tried again the script i sent to you And the ones with your modifications , both work well and do not Die as you explained : fatal error "x outside of string" Below is my perl -v output : C:\>perl -v This is perl, v5.6.1 built for MS

Re: Perl Vs ...

2003-09-22 Thread Tassilo von Parseval
On Sun, Sep 21, 2003 at 09:17:38PM -1000 Marc Adler wrote: > * Tassilo von Parseval <[EMAIL PROTECTED]> [2003-09-21 20:27]: > > I was always of the opinion that knowing C is one of the essential > > things. Too many vital stuff is nowadays hidden away from the user in > > more recent languages (s

Re: using foreach on an array

2003-09-22 Thread Marius Roets
Wow, I didn't know that, and I have been using Perl for some time. Never too old to learn. >> The answer is in 'perldoc perlsyn': The "foreach" loop iterates over a normal list value and sets the vari- able VAR to be each element of the list in turn. If the variable is precede

Re: Perl Vs ...

2003-09-22 Thread Marc Adler
* Tassilo von Parseval <[EMAIL PROTECTED]> [2003-09-21 20:27]: > On Sun, Sep 21, 2003 at 09:28:21PM -0400 Paul Kraus wrote: > > > Perl was pretty much my first language. Not counting Business Basic and same > > old Pascal from high school. The more I learn the more I see that perl can > > handle j

online favorites project

2003-09-22 Thread Todd W.
xposted to: perl.beginners, perl.beginners.cgi I've wrote a web based program to store favorites online. I work on quite a few computers each week between home, work, and school and its something I've wanted for awhile. The program is account based so others can use it. It is free to use. The home