RE: Inline Edit -- File name

2004-09-22 Thread RArul
Thanks for the help. This works: perl -pe '$_ = "$ARGV \t $_"' trace.txt This doesn't: perl -pe '$_ = "$ARGV[0] \t $_"' trace.txt perldoc perlvar says that $ARGV must be used for command-line processors and in array-context as @ARGV for running scripts. Thanks, once again. -Original M

RE: Inline Edit -- File name

2004-09-22 Thread RArul
Well, I did try that with $ARGV[0], but to no avail. Yes, I had posted a POC. Here is the true code that would not print the file-name. What am I doing wrong? perl -pe '$_ = "$ARGV[0] \t $_"' trace.txt -Original Message- From: Jose Alves de Castro [mailto:[EMAIL PROTECTED] Sent: Wedne

Inline Edit -- File name

2004-09-22 Thread RArul
How will I get the file name when I do an inline edit like this: perl -i.orig -pe '$_ = $_' filename How would I get the file name in ? Thanks, Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Mod_Perl -- A very basic question to get started

2002-04-12 Thread RArul
Hello Friends, I have all the web-development done in ASP for W2K with IIS Web-Servers and am a newbie to mod_perl. I have a very basic question on this Perl technology. Here it is: What is the primodial or **chief use** of mod_perl with apache? --Is it to run CGI Scri

RE: Deleting the contents of a file

2002-04-11 Thread RArul
perldoc -f unlink -Original Message- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 10:26 AM To: [EMAIL PROTECTED] Subject: Deleting the contents of a file Hi, I want to opena datafile and erase it's all it's contents. Can anyone help? Thanks, Allison

Mod_Perl in Win2k/Apache-- Beginner

2002-04-04 Thread RArul
Could somebody posit to any resource, on writing a simple Database Accessing Webpage written in MOD_PERL? I am just whetting my feet on mod_perl and I just installed Apache 1.3 on W2K and have got mod_perl binary installed too. Thanks, Rex

RE: Processing Large Files

2002-03-13 Thread RArul
One of the primodial reasons for me to chop the file and see it was to see what it looks like! Since it worked for you for a 1GB sized file, within a wink of the eye,I am sure that I have strong suspicion in the line length. I guess, it might be one large 300 MB file with a single line content! Th

Processing Large Files

2002-03-13 Thread RArul
Friends, I need to process 300+ MB text files. I tried to open one such file; read 10 lines (line by line) and output those 10 lines to a new text file. Despite reading line by line, it was taking a very long time for processing. Is there anything that I can try to speed it up!! Here is my pront

RE: Error installing package

2002-03-07 Thread RArul
Peter, My trick worked. I uninstalled ActivePerl 631 and then again installed it. Now PPM is working like a charm and I was able to install all Modules. I was able to even use query command from ppm which showed all available packages. Thanks, Rex -Original Message- From: Arul, Rex Sen

RE: Error installing package

2002-03-07 Thread RArul
I am also having problems with PPM and have posted on Perl-Win-32-Users mailing list at activestate. For me it is Win32-Lanman package. I also having the same problems as you. I did the same thing yesterday and everything worked. It was Activestate Perl Build 631. I had problems with OS (With Wi

RE: Installing Perl

2002-03-05 Thread RArul
Visit: http://www.activestate.com/Products/Download/Get.plex?id=ActivePerl Currently Activestate Build Version 631 is the latest of Perl 5.6 on Activestate. You will it get it from the aforementioned link. This not only installs Perl on Windows OS, but also configures other ISAPI filters and reg

RE: ADO syntax

2002-02-13 Thread RArul
You should not expect VisualBasic behavior in Perl. You have to be punctilious for each paranthesis and braces. Try to create a separate scalar var for say $objParam like this (that saves some typing): $objParam = $objCmd->Parameters; $objParam->Append($

RE: Using =~ with a list

2002-02-04 Thread RArul
> > Eeek. A map in void context! Please don't do that. > If I do not sound inane, could you please clarify the following: a) Why do perl gurus exhort, not to use 'grep' or 'map' functions under void context? b) What other functions, are to be avoided in 'void' context? Thanks, Rex

Regex help Please...

2002-01-31 Thread RArul
I know this is not a good RegEx. Can I see some criticism and fine-tuning of this RegEx that I came up with? Objective: To parse the path to drive, directory and file name. Here is what I came up with. # $fullpath = "C:/TopDir/outer/inner/file.fl"; ($drive, $pat

RE: Printing Ordered Hash Values

2002-01-31 Thread RArul
> > Reversing the hash is more work than it's worth, as you've found out. Certainly true and here is my mea culpa :))- It just did not occur to me about the, @keys = sort { $hash{$b} <=> $hash{$a} } keys %hash; statement. Thanks Japhy and Nikola. - Rex

Printing Ordered Hash Values

2002-01-31 Thread RArul
I have a simple hash with directory names as keys and sizes as values. I would like to print the hash, in descending order of the size of each directory. I was contemplating of "reversing" the hash(so that sizes become keys and directory names become values) and then do a sort on the keys. Howeve

RE: File::Find on Win32 -- Directory Permissions Denied

2002-01-30 Thread RArul
Arrgh...I am sorry for not being clear. The script is running under the context of my username. I know that I do not have permissions on certain directories. However, I would like to know how to detect it in Perl. perl -e "print(-d 'z:/xxx');" prints a 1, even though z:/xxx directory cannot be ac

RE: File::Find on Win32 -- Directory Permissions Denied

2002-01-30 Thread RArul
The script is not intended to run on an internet(server) environment. It is supposed to run as a stand-alone script from one of the machines (trusted) in the domain. All that I was hoping for, is a way to check whether I am able to read a directory and if so calculate the sizes of the directories

File::Find on Win32 -- Directory Permissions Denied

2002-01-30 Thread RArul
I am trying to use File::Find module on Win NT 4.0 with Activestate Perl to find the directory sizes on a network share drive. If the individual directories are protected by Windows NTFS permissions, the File::Find module throws a warning message on STDOUT saying "Can't opendir(Z:/blahblah): Inval

RE: a very simple question

2002-01-29 Thread RArul
Tanton: I am sure we could do it in one step as this: $str =~ s/(\d\d\s*)$/$1; Right? -- Rex > -Original Message- > From: Tanton Gibbs [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 29, 2002 4:18 PM > To: Dhiraj P Nilange; [EMAIL PROTECTED] > Subject: Re: a very simple qu

File Flushing

2002-01-29 Thread RArul
Friends, How can we can programatically control the flushing out of an output buffer so that during an iterative process, the contents can be periodically flushed out to the output buffer? Say, in this test snippet code, what should I do in order to flush the contents for every 10th record? - Re

RE: How to prevent redefining a variable with use strict?

2002-01-28 Thread RArul
John, Thanks for your input. However, what I was expecting was to have variables that are scoped properly without being accidentally redefined within the same scope. Using constants would prevent the "redefining" problem, nonetheless they would not allow me to alter the values either! In VBScrip

How to prevent redefining a variable with use strict?

2002-01-28 Thread RArul
Friends, When we use strict pragma, is there a way to "prevent" redefining a variable? use strict; my ($i) = 5;# $i defined print ("Val of i = $i"); my ($i) = 6;# $i redefined?Could this be tagged as an error? print ("Val of i = $i"); Thanks, Rex

RE: which browser

2002-01-17 Thread RArul
Check for the %ENV Variable for HTTP_USER_AGENT. That contains the information of the browser executing the perl script. -- Rex > -Original Message- > From: Jerry Preston [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 17, 2002 3:59 PM > To: begginners > Subject: which browser > >

RE: CGI vs. Servlet technologies

2002-01-08 Thread RArul
Servlets are more scalable than CGIs and that is what is one of the biggest advantages! A Servlet is instantiated for the first request and any subsequent requests to the same servlet spawns a separate thread, whereas CGIs are costly and had to be instantiated afresh for every fresh request. This

RE: CGI scripts in Perl

2002-01-08 Thread RArul
Visit this URL and configure your machine accordingly. http://support.microsoft.com/default.aspx?scid=kb;EN-US;q150629 -- Rex > -Original Message- > From: Naveen Parmar [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 08, 2002 1:39 PM > To: [EMAIL PROTECTED] > Subject: CGI scripts i

RE: deleting white spaces

2001-11-28 Thread RArul
Ahmed, As it was an oversight and Jenda had rightly pointed out, my solution eats up one space if there is more than one concatenated space! $string =~ s/\s{1}(?=\S)//g; By the aforementioned statement, I meant -- Match a space that is immediately followed by a non-space character. If a find is

RE: deleting white spaces

2001-11-28 Thread RArul
Let me give it a shot...How about this? --Rex $string = "I want to delete all this spaces, but this"; $string =~ s/\s{1}(?=\w)//g; print $string; > -Original Message- > From: Pedro A Reche Gallardo [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 28, 2001 1:06 PM > T

Basic Questions

2001-11-26 Thread RArul
Friends, I would appreciate if you can throw light more on the subteleties of the following two questions:I have this code and comments for the ease of understanding my questions: # #!/usr/bin/perl use strict; # IF I do not assign {},

Basic Question on %ENV

2001-11-26 Thread RArul
Friends, Here is a basic question on %ENV hash. I gave a pronto statement as thus: perl -e "print $ENV{ComputerName};" and it printed the correct information. On my MS-DOS prompt when I gave the SET command, I noticed that the environmental variable for ComputerName to be denoted as COMPUTER

RE: How to delete hash element

2001-11-20 Thread RArul
Still you should be able to handle it. Study the output: use strict; my(%hash) = ('name1'=>['Joe','Doe'], 'name2'=>['Ahmed', 'Basha']); while(my($key,$val) = each %hash){ print ("$key ==> @$val\n"); } delete(${$hash{'name2'}}[0]); while(my($key,$val) =

RE: How to delete hash element

2001-11-20 Thread RArul
That is what delete function does. It deletes both the key and the element it posits to. -- Rex > -Original Message- > From: Mike Rapuano [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 20, 2001 3:57 PM > To: Daniel Gardner; Ahmed Moustafa Ibrahim Ahmed > Cc: [EMAIL PROTECTED] > Su

RE: Command Line arguments.

2001-11-20 Thread RArul
The command-line arguments are stored in the built-in @ARGV array. Therefore, if you say something like : perl sample.pl argument1 argument2 argument3 then in your program you can access each of the command-line arguments as follows print $ARGV[0]; #prints argument1 print $ARGV[1]; #prints arg

RE: Perl script for COM application

2001-11-16 Thread RArul
> 1.Shutdown the WWW publishing services and disable the service. Use Win32 module and Win32::Service module. > > 2.Shutdown a COM+Application Use Win32 Module and use GetActiveObject or just Win32::OLE->new methods -- Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

[Follow-up]RE: Printing with arrow notation

2001-11-15 Thread RArul
In my response, shown below, if I replace $rhash=shift; # My approach with $rhash=@_;# Your Approach then nothing will be printed. The reason is that the results are interpreted in a scalar notation when you adopt the latter approach. Therefore, never attempt to do an ass

RE: Printing with arrow notation

2001-11-15 Thread RArul
%hash =('key1'=>'value1','key2'=> 'value2'); PrintHash(\%hash); sub PrintHash{ $rhash = shift; for(keys %{$rhash}){ print "$_ => $rhash->{$_}\n"; } } would work. -- Rex -Original Message- From: jonathan vandine [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001

Array References - Concatenation

2001-11-14 Thread RArul
Friends, I have two, two-dimensional array references, and I need to join the rows of each array. $array1 = [ [11,12], [21,22], [31,32] ]; and $array2 = [ [18,19],

RE: [Socket] Question

2001-11-09 Thread RArul
Thanks John. The purpose was not to send email. I was just trying to see if I am able to do a conversation with some server using a socket, as I am just learning to program a socket. No I have not read RFC2821, but I am familiar with the basic SMTP commands. Thanks, Rex -Original Message

RE: Off-Topic (200%) - Where are you from?

2001-11-09 Thread RArul
Atlanta, Georgia Rex :)- -Original Message- From: Wagner-David [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 10:26 AM To: 'Etienne Marcotte'; [EMAIL PROTECTED] Subject: RE: Off-Topic (200%) - Where are you from? San Jose, CA Wags ;) -- To unsubscribe, e-mail: [

[Socket] Question

2001-11-09 Thread RArul
Friends, I am trying to learn little bit of socket programming in Perl. I tried one of the code snippet from Perl cookbook as a starting point. I am tring to 'talk' to my SMTP mail server. But when I type HELO through the console, it seems like my script is not writing to the server socket and i

RE: Problem with IF statement

2001-11-08 Thread RArul
It was an oversight and I stand corrected. Thanks. -- Rex -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 08, 2001 10:54 AM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: Problem with IF statement An if/else with the same code is

Re: Problem with IF statement

2001-11-08 Thread RArul
Just add teh sprintf to the else block too. else { $year = sprintf("%02d",$now[5] % 100); } -- Rex -Original Message- From: Glenn Cannon [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 08, 2001 10:47 AM To: [EMAIL PROTECTED] Subject: Problem with IF statement I am trying to force

RE: is there another way to do this?

2001-11-08 Thread RArul
> Is there another way to get access to the environment variables... this > works, but it seems kind of kludgy.. perl -e "map{ print qq[$_ => $ENV{$_}]} keys %ENV;" -- Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: $a = $b eq "" ? 1 : 0;

2001-10-30 Thread RArul
If the username is equal to admin, $allowed is assigned 1 or else it is assigned a value of 0. Rex -Original Message- From: Etienne Marcotte [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 9:56 AM To: [EMAIL PROTECTED] Subject: $a = $b eq "" ? 1 : 0; $allowed = $username eq

Perl based Notification System

2001-10-29 Thread RArul
Dear Friends, I need some advice. I need to track some events happening on the Database end, and then alert the end-clients of an event. Say for example, I submit some data, my Perl ASP/CGI page should alert the end-user about that. I thought about this: a) Having a minimized Web browser window

RE: newbie : how to find the latest file in a directory

2001-10-29 Thread RArul
>The order of sorting is O(nlgn) (I think perl uses quicksort). >Finding the maximum or minimum in a list can be done >in O(n) time. This being the case sorting the files by age >is not the best solution. Just to keep the records straight, @sortedFiles = sort{ -M $a <=> -M $b} @files; is a

FW: thx

2001-10-29 Thread RArul
When you say sort($a cmp $b) it sorts ascendingly. When you say sort{$b <=> $a) it sorts descendingly. Cheers, Rex -Original Message- From: nafiseh saberi [mailto:[EMAIL PROTECTED]] Sent: Monday, October 29, 2001 7:48 AM To: Rex Arul Subject: thx hi. I am from Iran... thx...but do you

use strict and foreach

2001-10-26 Thread RArul
Friends, When I wish to simultaneously output the information to console screen as well a log file, I am getting an error if I have the use strict pragma turned on. If I comment it out, it works fine. How would I overcome this problem? Here is the pseudo-code: use strict; use FileHandle; use

RE: Maintaining Order of Keys in a Hash

2001-10-24 Thread RArul
Peter: Here are some interesting points that I had observed in my analysis where PerlScript was very much sluggish vis-a-vis JavaScript and VBScript. The purpose of me doing that was this. The recordset is being given to the ASP Page as I had shown before. However, when the data is presented it

RE: Why doesn't RETURN work?

2001-10-24 Thread RArul
How about if($a == $b) ? -Original Message- From: Gross, Stephan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 9:47 AM To: 'Beginner Perl' Subject: Why doesn't RETURN work? I have a subroutine sub xyz { if ($a = $b) { return; } } When I run th

RE: Assistance with Array.

2001-10-22 Thread RArul
Oops..Sorry for the typo...Perl Arrays are 0 based arrays. So they start with 0. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 5:33 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Assistance with Array. 1) Perl Arrays are 0

RE: Assistance with Array.

2001-10-22 Thread RArul
1) Perl Arrays are 0 based arrays. So they start with 1. 2) For array, @item, $#item will give you the last index. Therefore the array's count number of elements can be obtained from $#item + 1 3) scalar(@item) will give you the total count number of elements. 4)@item[4] will give you the 5th elem

RE: create hash and print all elements?

2001-10-22 Thread RArul
This is all that you need: use strict ; my %hash = ("sky", "blue", "grass", "green", "apple", "red") ; while(my($key, $val) = each(%hash)){ print("$key ==> $val\n"); } -Original Message- From: Neclos [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 3:13 PM To: [EMAIL PRO

RE: What is Auto-Vivification

2001-10-18 Thread RArul
Thanks Curtis. However, I am not seeing what you had mentioned in your response. When I tested this code, it did not create a key called 'key3'. #!/usr/bin/perl # Test Auto-vivification use strict; my(%hash); %hash = ( 'key1'=>'val1', 'key2'=>'val2'); #Please note that

What is Auto-Vivification

2001-10-18 Thread RArul
Friends -- Could you briefly explain the term "auto-vivification"? I have seen this quite a few times in some of the responses. A simple example to prove the point would be greatly appreciated. Thanks, Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

RE: Graphs

2001-10-05 Thread RArul
Use GD module GD::Graph, GD::Graph3d modules are available at CPAN and Activestate. -Original Message- From: James Ferree [mailto:[EMAIL PROTECTED]] Sent: Friday, October 05, 2001 2:35 PM To: [EMAIL PROTECTED] Subject: Graphs Hi, Any good books on how to create graphs using Perl? Whi

RE: passing array to pl/sql proced

2001-10-05 Thread RArul
To my knowledge there is no binding in Net8-DBD::Oracle-DBI that would allow you to pass Array Values to the Stored Procedure. You have to pass it as one large text stream and do your parsing in the Database. Else, do your own parsing logic in Perl and call the Proc accordingly. -- Rex -Or

RE: Periodic Auto Start

2001-10-04 Thread RArul
If your OS is Windows NT use AT tool that comes with Windows NT. It is a command-line utility that schedules stuff on a periodic basis. If your OS is Win9x, then use Windows Task Scheduler. You also have a number of utilities like WinCron http://www.tomasello.com/software/wincron/ -Origina

RE: index of an array element

2001-10-03 Thread RArul
Mini, In that case, my original supposition holds good. This code would work exactly for your case. #!/usr/bin/perl use strict; my($array) = ["GMM_ASSIGN_REQ", "TLLI=0x123456", "TLLI_INDEX=00", "LLC_PDU=blahblah"]; my($str) = 'LLC_PDU'; my($index) = indexOf($array,$str); print ("Index of $str i

RE: index of an array element

2001-10-03 Thread RArul
For key-value pair type of lists, hashes are the way to go. I had shown the other way using a list, which does not need the 'key-value' caveat. However for your case, Mini, you need to tread the hash path as shown by Sudarshan. Here is a code snippet you can try. #!/usr/bin/perl my($hash) = {a

RE: Getting frustrated. DBI Access 97 issues.

2001-10-02 Thread RArul
After finishing your query, please make it a point to explicitly relieve the database objects. This includes statements like these: $dbh->disconnect; undef $dbh; In fact, I do undef $sth too, even though that is not needed. However, please consider doing the above as it might be a problem with

RE: Storing a Decryptable Password?

2001-10-02 Thread RArul
-Original Message- From: Arul, Rex Sent: Tuesday, October 02, 2001 4:43 PM To: 'Barry McClintock' Cc: '[EMAIL PROTECTED]' Subject: RE: Storing a Decryptable Password? By using Perl Development Kit of Activestate Corp: http://aspn.activestate.com/ASPN/Downloads/PDK/ -Original Me

RE: Storing a Decryptable Password?

2001-10-02 Thread RArul
By using Perl Development Kit of Activestate Corp: http://aspn.activestate.com/ASPN/Downloads/PDK/ -Original Message- From: Barry McClintock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:33 PM To: '[EMAIL PROTECTED]' Subject: RE: Storing a Decryptable Password? how do y

FW: Storing a Decryptable Password?

2001-10-02 Thread RArul
Read this article, which implements RC4 Symmetric encryption in VBScript. http://www.4guysfromrolla.com/webtech/010100-1.shtml I mimicked the idea by creating a Perl DLL which would encrypt a plain-text password. The logic behind a symmetric encryption is that you provide a key which would e

RE: Command line interface

2001-08-14 Thread RArul
Use GetOpt::Long or GetOpt::Std modules for processing command-line options. - Rex -Original Message- From: Schooley, Chris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 1:47 PM To: '[EMAIL PROTECTED]' Subject: Command line interface I am working on a program that has users

RE: Converting into exe

2001-08-14 Thread RArul
http://www.activestate.com Please download the Perl Development Kit with the trial license. Using PerlApp that comes with PDK, you can create both Perl EXEs and Freestanding EXEs. -- Rex -Original Message- From: Najamuddin, Junaid [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 200

RE: Hashes with multiple values per key

2001-08-07 Thread RArul
I am afraid, I have different stats with my study: I ran for 100,000 loops and for 1,000,000 loops but yet, the map,grep contexts are giving me efficient stats than the foreach loop stuff. Since our comparing contexts differ, there might be significant difference between the two approaches, I gue

RE: Hashes with multiple values per key

2001-08-07 Thread RArul
#!/usr/bin/perl #More Explanatory Way $hash{'jmj'} = ['john','doe','laura','george','bill','nelson']; for $ele ( @{$hash{'jmj'}} ) { if( $ele eq 'george' ) { print "Take working Vacation Bud!\n"; } } #Mode Idiomatic Way and is more efficient too! map { print