RE: Execute commands on the servers through a cgi script

2005-01-09 Thread Manav Mathur
Are you sure you want to do this. The type of page you are developing has been long been a security headache. Imagine the user entering /bin/date -s 20050427; cat /etc/passwd | mail -s 'there you are' I understand that you are trying to implement remote root tasks through CGI, but you must consi

RE: display html using perl class

2005-01-11 Thread Manav Mathur
Which webserver are you using? Is /cgi-perl/ directory enabled for executing scripts?? For Apache, you might be interested in the Scriptalias directive. Manav |-Original Message- |From: Graeme McLaren [mailto:[EMAIL PROTECTED] |Sent: Tuesday, January 11, 2005 6:14 PM |To: beginners@perl

RE: regex needed

2005-01-18 Thread Manav Mathur
Chris , cant get to you. 1) Use $RouteArray[2] instead of $RouteArray['2'] 2) POst me the 11th route entry |-Original Message- |From: Chris Knipe [mailto:[EMAIL PROTECTED] |Sent: Tuesday, January 18, 2005 7:55 PM |To: beginners@perl.org |Subject: Re: regex needed | | |Hi Randy, | |Ok tha

RE: regex needed

2005-01-18 Thread Manav Mathur
t) { s/^\s*// ; chomp ; my @RouteArray = split(/ +/,$_,8); if (($RouteArray[2] =~ /^\s*S$/) and ($RouteArray[5] =~ m/^165\.(165|146)/) and ($RouteArray[7] =~ m/National\s*Gateway/i)) { $Terminal->cmd("ip route remove " . $RouteArray[1]); } } |-----Ori

RE: regex needed

2005-01-19 Thread Manav Mathur
spaces at the start and in some, there werent any. So, the split was making $RouteArray[n] different for dfferent entries. Thats why I have introduced an additional s/^\s*//; to get rid of the spaces |-Original Message- |From: Manav Mathur [mailto:[EMAIL PROTECTED] |Sent: Wednesday, January

FW: regex needed

2005-01-19 Thread Manav Mathur
Still cant get to you chris -Original Message- From: Manav Mathur [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 9:44 PM To: Chris Knipe Subject: RE: regex needed Sure thing. I have put my updated scripts in perl.org. As I love making mistakes :( , you must refer to the

RE: cpan slow ?

2005-01-20 Thread Manav Mathur
Im facing the same issue. again from India. yesterday didnt go on the site but today, there's a definite problem Manav |-Original Message- |From: Harsh Busa [mailto:[EMAIL PROTECTED] |Sent: Thursday, January 20, 2005 11:18 PM |To: beginners@perl.org |Subject: cpan slow ? | | |hi | |i m t

RE: cpan slow ?

2005-01-21 Thread Manav Mathur
Now, Its running fine here too. |-Original Message- |From: Chris Brown [mailto:[EMAIL PROTECTED] |Sent: Friday, January 21, 2005 3:56 PM |To: beginners@perl.org |Subject: Re: cpan slow ? | | |I was having problems (in Peterborough, UK) but it all seems to be |running fine again now. | |

RE: How to read this array?

2005-01-26 Thread Manav Mathur
my($val)=$history[0]->{'input_contents'} =~ m/\$id\s*=\s*\'([^']*)\'\;/ ; print $val ; Manav |-Original Message- |From: Jerry Preston [mailto:[EMAIL PROTECTED] |Sent: Wednesday, January 26, 2005 5:58 PM |To: 'Perl Beginners' |Subject: How to read this array? | | |I have this array and I

RE: using namespace

2005-01-27 Thread Manav Mathur
see perldoc -f import perldoc -f use and what happens when you use Some::Module (qw/somefunction1 somefunction2/) ; Manav |-Original Message- |From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED] |Sent: Thursday, January 27, 2005 2:33 PM |To: perl beginners |Subject: using namespace

RE: How to find the Index of an element in array?

2005-01-27 Thread Manav Mathur
Rob, In your solution $hash{'pqr'} will return 3. - iniitalize $i with 1 or - %hash=map{$_=>[EMAIL PROTECTED]; Manav |-Original Message- |From: Rob Napier [mailto:[EMAIL PROTECTED] |Sent: Thursday, January 27, 2005 2:06 PM |To: Richard Chycoski |Cc: Mallik; Perl-Trolls; beginners@perl.o

RE: File is not getting created in perl CGI

2005-01-31 Thread Manav Mathur
use CGI::Carp qw(fatalsToBrowser) ; will redirect the error messages to the browser(if you are not checking the webserver logs, please do so immediately). Manav -Original Message- From: Anish Kumar K. [mailto:[EMAIL PROTECTED] Sent: Monday, January 31, 2005 7:41 PM To: beginners perl Su

RE: Subroutine for a scripts progress

2005-02-02 Thread Manav Mathur
you can use the perl debugger for that. see perldoc perldebug -Original Message- From: Gavin Henry [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 02, 2005 5:36 PM To: beginners@perl.org Subject: Subroutine for a scripts progress Dear all, I haven't coded anything yet, but I was

RE: file input/output

2005-02-03 Thread Manav Mathur
That is because you are *not* printing "Browser Test" to the OUTFILE handle. open(OUTFILE, ">>survey.txt"); print OUTFILE "this is a test!!!\n"; print OUTFILE "Browser test\n"; close(OUTFILE); -Original Message- From: Elliot Holden [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03,

RE: Deleting selected files in a directory through perl

2005-02-04 Thread Manav Mathur
my @files= ; ##should be good enough -Original Message- From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED] Sent: Friday, February 04, 2005 1:57 PM To: beginners@perl.org Subject: Re: Deleting selected files in a directory through perl Kamalraj Singh Madhan, Noida [KSM], on Friday, F

RE: configuration steps for perl with apache to support cgi-file

2005-02-04 Thread Manav Mathur
httpd.conf == - Hope you Servername dorective is already correct - Add(or uncomment) ScriptAlias /cgi-bin/ "/path/to/Apache/cgi-bin/" - Add(or uncomment) AllowOverride None Options ExecCGI -Original Message- From: vishwas bhakit [mailto:[EMAIL PROTECTED] Sent: Friday,

RE: Changing the path in @INC

2005-02-10 Thread Manav Mathur
shift accepts only one argument, the array. and shifts of an element from the beginning of the array. -Original Message- From: bright true [mailto:[EMAIL PROTECTED] Sent: Thursday, February 10, 2005 6:43 PM To: Boysenberry Payne Cc: beginners@perl.org Subject: Re: Changing the path in @IN

RE: simple substitution question

2005-02-18 Thread Manav Mathur
=~ is the bind operator. see perldoc perlop. Manav -Original Message- From: Harold Castro [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2005 12:17 PM To: beginners@perl.org Subject: simple substitution question Hi, There is something that's bothering me for so long regarding

RE: Perl waits for while to finish before printing if on the same line,why?(countdown prog)

2005-02-20 Thread Manav Mathur
Try this my $countdown = 5; local $|=1 ; while ($countdown > 0){ print "\."; sleep 1; $countdown--; } print "Kaboom!!" -Original Message- From: Mark Jayson Alvarez [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 9:39 AM To: beginners@perl.org Subject: Perl waits for while to fi

RE: Perl waits for while to finish before printing if on thesameline,why?(countdown prog)

2005-02-20 Thread Manav Mathur
Are you using it as a command line tool or as CGI etc?? Manav -Original Message- From: Mallik [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 1:12 PM To: beginners@perl.org Cc: 'Manav Mathur'; 'Mark Jayson Alvarez' Subject: RE: Perl waits for while to finis

RE: Perl waits for while to finish before printing ifonthesameline,why?(countdown prog)

2005-02-20 Thread Manav Mathur
The same code works here on ActivePerl. As far as I know, some web-servers do default buffering...thats why I asked if you were using it as CGI Manav -Original Message- From: Mallik [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 1:21 PM To: 'Manav Mathur';

RE: Listing a Windows file, getting creation date

2005-02-24 Thread Manav Mathur
use strict ; use warnings ; use File::find ; my %hash ; my %by_value ; find(sub{$hash{$_}=(stat $_)[9]},'/path/to/Udb/Backups') ; while (($key, $value) = each %hash) { push @{$by_value{$value}}, $key; } my @[EMAIL PROTECTED] {$a <=> $b} keys %by_value ; local $"="\n" ; print "@array[0..2]" ;

RE: code on stonehenge.com for adding line numbers to code

2005-03-01 Thread Manav Mathur
This?? perl -i.bak -ne 'print "=$.= $_"' /path/to/code_file Manav -Original Message- From: Gavin Henry [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 5:44 PM To: beginners@perl.org Subject: Re: code on stonehenge.com for adding line numbers to code > is this what you are loo

RE: accidently changed stdout | can't print to screen

2005-03-01 Thread Manav Mathur
Also, there should be a space between #!/usr/bin/perl and the -w switch. Manav -Original Message- From: bright true [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 10:51 PM To: Earthlink-m_ryan Cc: beginners@perl.org Subject: Re: accidently changed stdout | can't print to screen

RE: output from system call

2005-03-08 Thread Manav Mathur
chomp($date=`date`) ; ##exploiting what Perl offers but C doesnt -Original Message- From: Ankur Gupta [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08, 2005 10:03 PM To: [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: output from system call [EMAIL PROTECTED] wrote: >Hi, >Is th

RE: tricky hash

2005-03-08 Thread Manav Mathur
use strict; use warnings; use Data::Dumper ; my %kw = (); my $kw = \%kw; my $i = 1; for my $cat (split(/\//, 'something/other/foo/bar')) { $kw->{"cat".eval{$i++}} = $cat } print Dumper \%kw ; -Original Message- From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08,

RE: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Manav Mathur
;) $a is an anonymous reference to the array defined @$a resolves that reference [EMAIL PROTECTED] prints out the index of the last element of array $a->[elemmentnumber] is used to access an element thru an array reference. so $a->[EMAIL PROTECTED] simply gives you the last element of the array

RE: How to figure out Size of Var.

2005-03-11 Thread Manav Mathur
See perldoc -f length Manav -Original Message- From: Bastian Angerstein [mailto:[EMAIL PROTECTED] Sent: Friday, March 11, 2005 1:36 PM To: beginners@perl.org Subject: How to figure out Size of Var. How can I figure out how many chars are stored in a variable? Or how can I determit th

RE: System o/p to a varaible

2005-03-15 Thread Manav Mathur
-Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 16, 2005 12:06 AM To: Perl Beginners List Cc: Anish Kumar K. Subject: Re: System o/p to a varaible On Mar 15, Chris Devers said: >system($command) >or die "Couldn't run command '$co

RE: very new - need help with regular expressions

2005-03-26 Thread Manav Mathur
|-Original Message- |From: Brett Williams [mailto:[EMAIL PROTECTED] |Sent: Saturday, March 26, 2005 3:01 PM |To: beginners@perl.org |Subject: re: very new - need help with regular expressions | | |Thank you Manav :) | |That was a big help. I now have another problem however. I had assume

RE: Match a pattern

2005-04-19 Thread Manav Mathur
|-Original Message- |From: lio lop [mailto:[EMAIL PROTECTED] |Sent: Tuesday, April 19, 2005 5:44 PM |To: beginners@perl.org |Subject: Match a pattern | | |I need to print the text between two words | that are in different |lines. | Assuming you want to get all

RE: Require / Use

2005-04-21 Thread Manav Mathur
Additionally, the import method defined in a package(or inhertied by it) is not called when you 'require' a module. So, even @EXPORT symbols in the 'require'd module (which are by default imported in the current namespace when you 'use' it) are not imported. See perldoc perlmod for more on this.

RE: Require / Use

2005-04-21 Thread Manav Mathur
perldoc perlmod also goes to say An exception would be if two modules each tried to "use" each other, and each also called a function from that other module. In that case, it's easy to use "require"s instead. anyone knows how/why require is useful in this case ?? |-Original Message- |F

RE: How can I automate the removal of hard-coded banners from locallysaved web pages

2005-04-29 Thread Manav Mathur
perl -i -pe 's/offending_code//g' /path/to/*.html |-Original Message- |From: Orel Stringa [mailto:[EMAIL PROTECTED] |Sent: Friday, April 29, 2005 5:21 PM |To: beginners@perl.org |Subject: How can I automate the removal of hard-coded banners from |locallysaved web pages | | |Hi, | |I somet

RE: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-29 Thread Manav Mathur
|-Original Message- |From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED] |Sent: Friday, April 29, 2005 7:11 PM |To: beginners@perl.org |Subject: Re: REGEXP removing - il- - -b-f and - il- - - - f | | |[EMAIL PROTECTED] [D], on Friday, April 29, 2005 at 09:30 (-0400) |wrote about: | |DOc

RE: Translate standard date/time format to EPOCH seconds

2005-05-02 Thread Manav Mathur
|-Original Message- |From: John Doe [mailto:[EMAIL PROTECTED] |Sent: Tuesday, May 03, 2005 1:50 AM |To: beginners@perl.org |Subject: Re: Translate standard date/time format to EPOCH seconds | | |Am Montag, 2. Mai 2005 19.52 schrieb Charles K. Clarkson: |> [EMAIL PROTECTED]

RE: calling a separate perl script from within another perl script

2005-05-12 Thread Manav Mathur
|-Original Message- |From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] |Sent: Thursday, May 12, 2005 3:01 AM |To: beginners@perl.org |Subject: calling a separate perl script from within another perl script | | |All, | |I have done some reading and know there are various way to do this, bu

RE: Threads related document to refer in perl

2005-05-16 Thread Manav Mathur
|-Original Message- |From: Gayatri [mailto:[EMAIL PROTECTED] |Sent: Monday, May 16, 2005 10:40 AM |To: beginners@perl.org |Subject: Threads related document to refer in perl | | |Hello Friends, | | | |I want to create threads using perl. | |So if any documents or links are there to refer

RE: output in a single line

2005-05-25 Thread Manav Mathur
you forgot to chomp both your currency holders. Both contain a newline at the end, but the second one _appears_ ok to your eyes coz its the end of the line. You should chomp both (as shown below), and then format your output with any newlines if necessary... |-Original Message- |From: Vin

RE: search a file

2005-05-26 Thread Manav Mathur
See perldoc -f glob and the angle bracket operator in perldoc perlop @files = glob("*.v") ; #or @files = <*.v> ; |-Original Message- |From: Eliyah [mailto:[EMAIL PROTECTED] |Sent: Thursday, May 26, 2005 3:10 PM |To: beginners@perl.org |Subject: search a file | | |Hello, I'm writing a s

RE: simple open file

2005-05-31 Thread Manav Mathur
|-Original Message- |From: lance w [mailto:[EMAIL PROTECTED] |Sent: Tuesday, May 31, 2005 6:42 PM |To: beginners@perl.org |Subject: simple open file | | |Hello, |I'm trying to open (create if necessary) a file for APPEND, that will |serve as a log. The script I'm using will open a file, b

open() to unix command

2005-06-07 Thread Manav Mathur
Hi all, In the usual case when we code something like open(TO_PIPE,"| sendmail blah blah") or die("$! : fork failed") ; ##do something here close(TO_PIPE) or die("$! : bad sendmail") ; What does perl do when it encounters the open() and the close() statements?? Especially, why can an error in s

RE: find and replace large blocks

2005-06-07 Thread Manav Mathur
Yes. As your requirements stated are not very specific, I'd recommend you to see the entries for $/ (in perldco perlvar) /s modifier for s/// operator. |-Original Message- |From: Cy Kurtz [mailto:[EMAIL PROTECTED] |Sent: Tuesday, June 07, 2005 6:21 PM |To: beginners@perl.org |Subject: fin

Re: Regular expression not working as expected

2005-08-11 Thread Manav Mathur
According to the tutorial I'm following: {n}matches exactly n of the previous thing Thus I expect: "fo" =~ /o{2}/ = false "foo" =~ /o{2}/ = true "fooo" =~ /o{2}/ = false Instead I get: "fo" =~ /o{2}/ = false "foo" =~ /o{2}/ =

Re: Misuse of "use"?

2005-08-12 Thread Manav Mathur
> On Aug 12, Randy Macdonald said: > > > However, when I run: > > > > print ''; > > use NotARealPackage; > > print ''; > > > > I expect to get: > > > > > > > > but I get no output at all. Why is this? > > The 'use' statement is special to Perl. It is executed at compile-time, > not at run-time li

Re: parsing columns

2005-08-14 Thread Manav Mathur
>Hi all, >I have a text file with columns, where the columns may not be aligned, >and not all lines may have data in all columns: > >header1 header2 header3header4 > >l1dat1l1dat2l1dat3 l1dat4 >l2dat1

Re: I finally did it- Packages

2005-08-15 Thread Manav Mathur
> I have just successfully figured out how to get the "return" from a > "package" > in the main program.. > > @Data = ReadFile::ReadFile("TownCrier.db"); > > Wha Hoo > > ANYONE having more informtion on making and using packages, please let me > know. > My 6 book library barely mentions it

Re: matching pattern & printing

2005-08-17 Thread Manav Mathur
> Hi: > > In the following perl script, I would like to print all the lines in a file > (mdout_short.txt) to temp.txt which have "NSTEP" as a word: > > > use strict; > use warnings; > > my $mdout_file = "mdout_short.txt"; > > my $mdout_xtemp_file =

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread Manav Mathur
>I have a series of EZMLM configuration files in the ~alias directory that look like this: >main:/var/qmail/alias# cat cire/config >F:-aBCdEFGHiJKlmnOpQrStuVWXYZ >X: >D:/var/qmail/alias/cire >T:/var/qmail/alias/.qmail-cire >L:cire >H:infoforhealthx.org main:/var/qmail/alias# >I want to find the

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread Manav Mathur
- Original Message - From: "KEVIN ZEMBOWER" <[EMAIL PROTECTED]> To: Sent: Thursday, August 18, 2005 1:06 AM Subject: Finding matches and use of __END__ in a one-liner I have a series of EZMLM configuration files in the ~alias directory that look like this: main:/var/qmail/alias# cat ci

Re: Use of uninitialized value in string at ... ??

2005-08-18 Thread Manav Mathur
> Hello, > > I got the following function online but and receiving the error and > do not know why ? > Use of uninitialized value in string at ./sat-main.pl line 211, > line 1 > > Here is the code: > > my $input; > > $input = &user_func("Enter command "); > > sub user_func { > my $user_i

Re: using system to run ssh $host command

2005-08-25 Thread Manav Mathur
Hi: Try this: = `rsh -l 'command arg1 arg2 ..`; This works for me, I don't know if this is the best way or if it the more secure way to run a command in a remore machine, try to search CPAN for a module that can do something similar. Pablo. On 8/24/05, grover mitchell <[EMAIL PROTECTED]>

Re: map/grep and arrays

2005-08-26 Thread Manav Mathur
- Original Message - From: "Tom Allison" <[EMAIL PROTECTED]> To: "beginners perl" Sent: Friday, August 26, 2005 4:49 PM Subject: map/grep and arrays > I keep getting hung up on what I think would be a simple problem. > > I was to do approximately this: > > Given an array of "stuff" p

Re: Need an explanation

2005-08-27 Thread Manav Mathur
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Friday, August 26, 2005 10:37 PM Subject: Re: Need an explanation > maybe this is brief: > > while (<>) { > chomp; > next if /^#/; > next if /^$/; > my ($var1,$var2)=split /=/;

Re: syntax Error ..........

2005-09-02 Thread Manav Mathur
- Original Message - From: <[EMAIL PROTECTED]> To: Sent: Saturday, September 03, 2005 12:20 AM Subject: syntax Error .. > > Hi Guys... > > Can u plz give me the write syntax for > this > > foreach (@lookup_datatype){ > my $plus; > ($plus) = /([0-9]+)/; > > > print "$plus