Re: A little off topic.

2001-08-08 Thread Rex Arul

Please visit http://www.activestate.com . They have PerlApp and PerlCOM
tools as part of the Perl Development Kit.

With PerlApp you can generate free running EXEs and with PerlCOM you can
create DLLs which can be invoked by any VB/VBScript/JScript code.



- Original Message -
From: "Michael Carmody" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 08, 2001 10:21 PM
Subject: A little off topic.


> Having crafted my masterpiece in perl, I now need to get it to run from
> within a VB script.
>
> (VB takes office file, converts to .csv, which perl scripts then parses,
> but poor secretary has to have excel doco to work on)
> So this is only in the interest of allowing perl to actually be used at my
> work in a real environment (as opposed to only me using when I need it)
> and being seen as a REAL tool, even though it's free/open source/not
microsoft
>
> So how do i get visual basic to call external executable files ?
> Such as perlscript.bat containing "perl myscript.pl"
>
> Any help doubly appreciated...
>
> Michael Carmody
> MDU, Public Health Lab
> Dept. of Microbiology and Immunology
> The University of Melbourne, Parkville
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: problem in knowing session variables .

2001-10-03 Thread Rex Arul

Rahul -- The Server sets the ASPSessionID if you have enabled the Session
state for your web server.

To access the collection of session variables and the corresponding values,
you might need to write some code as follows:

  foreach $key (in $Session->Contents){
 $Response->Write(qq{ Session Variable Name is  }.$key.qq{
which has a stored value of =>
}.$Session->Contents->Item($key)."");
  }

That would get you the list of session variables as well as its values.

Cheers,
Rex

- Original Message -
From: "Rahul Garg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 2:39 AM
Subject: problem in knowing session variables .


Hello,

i am fetching the asp page by filling in the form.
After filling in the form and submitting a request it requests the page
.
a session is established with some session variables.
How could i know what r the session variables involved in while fetching
the page. Any suggestions...


Thanks,
rahul







-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: index of an array element

2001-10-03 Thread Rex Arul

Will this be sufficient?

my($array) = ['a=1', 'b=2', 'c=3', 'd=4'];
my($str) = 'd=43';
my($index) = indexOf($array,$str);
print ("Index of $str in the array is = $index");

sub indexOf{
 my($arr) = shift;
 my($val) = shift;
 for(my $i=0; $i < @{$arr}; $i++){
  return($i) if($arr->[$i] eq $val);
 }
 return("undef"); #WE should not get here if a match is found
}


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 7:45 AM
Subject: index of an array element


>
>
> Hi ,
>
> Say I have an array in perl,
>
> @list = ("a=3", "b=5", "c=8", "d=9", "e=2", "f=0");
>
> Now I want to find the index of the element "d=9" ( Index of d=9 is 3 here
, as
> we all know ).
>
> How do we do that ??
>
> In perl what I can find that there exist a function "index", which returns
> position of the substring in string..like,
>
> $c = index(@list, "d" );
>
> This function will return me the value 13 or 12 perhapsas the
substring
> "d=9" begins from 13th position in the @list.
>
> My requirment is :
>
> $c = some_func(@list, "d"); .where some_func should return me
> 3. Can anybody help me.
>
> TIA,
> -Mini.
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: index of an array element

2001-10-03 Thread Rex Arul


But that would work only for key=value type of situations.

If @list = (2,'a',100,'cat')

then you cannot rely on Hashes because order cannot be preserved. At such
instances, you might need to code a custom function as shown in my previous
mail.

Right?

-- Rex

- Original Message -
From: "Sudarsan Raghavan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 8:18 AM
Subject: Re: index of an array element


> [EMAIL PROTECTED] wrote:
>
> > Hi ,
> >
> > Say I have an array in perl,
> >
> > @list = ("a=3", "b=5", "c=8", "d=9", "e=2", "f=0");
>
>looking at your list a hash seems like a better option, the hash will
be like
>
> %hashlist = (
>  a => 3,
>  b => 5,
>  c => 8,
>  d => 9,
>  e => 2,
>  f => 0);
>the reason being,  you are associating the numeric values (3, 5, 8
etc.) to the
> characters (a, b, c etc.)
>a hash (associative array) would be more useful here. Is my assumption
correct?
>
>To access the element 'd' you will say $hashlist{d}
>You can get more information on hashes from perldoc perldata
>
> >
> >
> > Now I want to find the index of the element "d=9" ( Index of d=9 is 3
here , as
> > we all know ).
> >
> > How do we do that ??
> >
> > In perl what I can find that there exist a function "index", which
returns
> > position of the substring in string..like,
> >
> > $c = index(@list, "d" );
>
> >
> >
> > This function will return me the value 13 or 12 perhapsas the
substring
> > "d=9" begins from 13th position in the @list.
> >
> > My requirment is :
> >
> > $c = some_func(@list, "d"); .where some_func should return
me
> > 3. Can anybody help me.
> >
> > TIA,
> > -Mini.
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: encrypt, decrypt module suggestions

2001-10-03 Thread Rex Arul

Use Crypt::RC4 module, to encrypt and decrypt values. It uses the RC4
Symmetric encryption which is fairly robust. It depends on a symmetric key
which you will use for encryption as well as decryption.  You can download
the latest Crypt::RC4 module through PPM. (Activestate Perl).

http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/Packages



- Original Message -
From: "Jeff Loetel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 7:38 PM
Subject: encrypt, decrypt module suggestions


> I'm looking for a module where I can encrypt and decrypt
> values. Obviously, the more secure the better. Most of
> everything that I have seen is in the way of one way
> hash digests. The main thing is I  have to be able to
> get the values back out.
>
> Suggestions appreciated.
>
> jeffl
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Compression

2001-10-05 Thread Rex Arul

Try Archive::Zip (to zip it into Zip format) or Compress:Zlib (GZip or
deflate/inflate compression schemes).

They are available from http://www.activestate.com and please use your PPM
to download the same.


- Original Message -
From: "Zhe Hong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 05, 2001 7:21 AM
Subject: Compression


> Hi to all the perl gurus and wonderful people in this list.
>
> I am on a very slow internet connection. (56kbps) My problem is I have
> to routinely upload a 20meg text file to my webhost. It usually takes 1
> and a half hours to do so. Is there a perl module that can compress the
> text file to say around 2 meg and uncompress it at the server so that I
> don't have to waste that much time uploading it?
>
> I'm running activeperl 5.6 on a win2k.
>
> Thanks in advance!
>
> Zhe
>
> PS: please excuse my english.
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Interact with microsoft Excel

2001-10-22 Thread Rex Arul

You can take a look at this beautiful article:
http://www-106.ibm.com/developerworks/library/l-pexcel/

-- Rex S. Arul


- Original Message -
From: "Kelvin Ng Chee Hoong" <[EMAIL PROTECTED]>
To: "nafiseh saberi" <[EMAIL PROTECTED]>
Cc: "perl_beginners" <[EMAIL PROTECTED]>
Sent: Monday, October 22, 2001 2:33 AM
Subject: Re: Interact with microsoft Excel


> Yes , I heard about Active Perl . But I'm using unix perl .  Can unix
> perl interact with microsoft excel ?
>
> nafiseh saberi wrote:
>
> >hi.
> >do you see " active perl " in windows...??
> >__
> >Best regards . Nafiseh Saberi
> >Iran   .
> >notes .
> >   Pray for Afghans people.
> >   Clothes , dont make the man.
> >  www.iraninfocenter.net
> >   www.sorna.net
> >___
> >- Original Message -
> >From: "Kelvin Ng Chee Hoong" <[EMAIL PROTECTED]>
> >To: "perl_beginners" <[EMAIL PROTECTED]>
> >Sent: Monday, October 22, 2001 09:31 AM
> >Subject: Interact with microsoft Excel
> >
> >
> >>Hi ;
> >>  I would like use perl to interact with microsoft excel - to
> query
> >>, update or delete data . Is it possible to do that ?  Where can I get
>
> >>documentation  on how perl interact with Microsoft excel ?
> >>
> >>Please advise 
> >>
> >>
> >>--
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >
> >
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Maintaining Order of Keys in a Hash

2001-10-22 Thread Rex Arul

Hello Friends,

Without resorting to any additional lists/arrays, how can I maintain the
order of the keys in a hash? Is there a "package/module" that would redress
this issue?

I would like to access data, the same order I added to the hash in the first
instance.

Thanks,
Rex



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Maintaining Order of Keys in a Hash

2001-10-23 Thread Rex Arul

Peter:

I am not sure how I can differ or accept your statement, which is sort of
appealing to me. Let me run this by you. On querying a database, I am
getting a recordset of this form:

2001-10-01 01:00:00 Amy  1020normal   555.234
2001-10-01 01:00:00JoeDoe1525high623.456
2001-10-01 01:00:00RexArul1020high772.265
2001-10-01 02:00:00Amy   1020high544.345
2001-10-01 02:00:00JoeDoe1525high689.52
2001-10-01 02:00:00RexArul 1020high800.002

As you could see the recordset is sorted by Date-Timestamp first and then by
the user-names second in the database. This is how the recordset is handed
out to my ASP Page. I slash the records into a hash with Date-Timestamp and
user-names being my hash keys (HashOfHashOfArrays):

Like this:

$returnHash->{getDTS($objRS->Fields(0)->{Value})}{$objRS->Fields(1)->{Value}
} =
[$objRS->Fields(2)->{Value},
$objRS->Fields(3)->{Value},$objRS->Fields(4)->{Value},$objRS->Fields(5)->{Va
lue}];

Now as you see the date-timestamp and usernames, both are not going to lose
their already sorted order from the database. Please shed some ideas as to
how this is would be construed as mismodelling.

Thanks in advance,
--Rex

- Original Message -
From: "Peter Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Rex Arul" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, October 23, 2001 1:45 AM
Subject: Re: Maintaining Order of Keys in a Hash


> At 09:52 PM 10/22/01 -0400, Jeff 'japhy' Pinyan wrote:
> >On Oct 22, Rex Arul said:
> >
> > >Without resorting to any additional lists/arrays, how can I maintain
the
> > >order of the keys in a hash? Is there a "package/module" that would
redress
> > >this issue?
> >
> >Tie::IxHash, on CPAN.
>
> It should be said, if you care about the order of the keys in your hash,
it
> is far more likely that you have mismodelled your problem than that you
> need to use IxHash.
>
> --
> Peter Scott
> Pacific Systems Design Technologies
> http://www.perldebugged.com
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: undef function

2001-10-23 Thread Rex Arul


$val=undef; #undef is more like a value here.

undef ($objRS); #undef is more of a function here
undef(%hash); #and here too

-- Rex

- Original Message -
From: <[EMAIL PROTECTED]>
To: "nafiseh saberi" <[EMAIL PROTECTED]>
Cc: "perl" <[EMAIL PROTECTED]>
Sent: Tuesday, October 23, 2001 5:58 AM
Subject: Re: undef function


> undef is not really a function ... delete is ...
> undef is (although many might disagree with me) more like a value not
unlike
> 1,2 or 'cowabunga' that just says there is no value (hope this makes
sense)
>
> but when u set a hash to undef it effectively deletes the hash from
existance
> ... (again i might be wrong about this one)
>
> On Tue, Oct 23, 2001 at 10:39:50AM +0330, nafiseh saberi shaped the
electrons to read:
> >
> >
> > hi all...
> > I read about "undef" a lot
> > but..
> > I dont understand the difference between "undef" and "delete".. ?
> > and why do we use undef...
> > thx
> > __
> > Best regards . Nafiseh Saberi
> > Iran   .
> > notes .
> >Pray for Afghans people.
> >Clothes , dont make the man.
> >   www.iraninfocenter.net
> >www.sorna.net
> > ___
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: no luck pie charts and perl

2001-10-25 Thread Rex Arul

If you declare the pragma, "use strictl" then you should declare all
variables as my:

my($im, $red, $blue);


- Original Message -
From: "tom poe" <[EMAIL PROTECTED]>
To: "zentara" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 7:10 PM
Subject: Re: no luck pie charts and perl


> On Thursday 25 October 2001 12:04, zentara wrote:
> > > tried this example, didn't work. In place of the picture I got
nothing,
> > >but something was using the space.
> > >see the code do I miss anything?
> > >thank you
> > >
> > >Pierre
> > >   use GD;
> > >
> > >   # create a new image
> > >$im = new GD::Image(100,100);
> > ># allocate some colors
> > >$red = $im->colorAllocate(255,0,0);
> > >$blue = $im->colorAllocate(0,0,255);
> > ># no background
> > >do I need the background
> > ># Draw a blue oval
> > >$im->arc(50,50,95,75,0,360,$blue);
> > ># And fill it with red
> > >$im->fill(50,50,$red);
> > ># make sure we are writing to a binary stream
>binmode DATA;
> # Convert the image to PNG and print it to createpng.png
> open DATA, ">createpng.png" or die "Cannot open createpng.png for writing:
> $!";
> print DATA $im->png;
> close DATA;
>
> > >print $im->png;
> >
> > It works for me if I direct the output to a file:
> > testgd.pl > test.png
> > then I can view test.png with my viewer
> > Maybe the code needs to be changed to print
> > to a file instead of STDOUT ??
>
>
> Hi, Zentara:  I fiddled [far more than one would expect], and used the
> recently posted write to file format above, and it works with the top
line,
> "#! /usr/bin/perl -w".  But, if I add "use strict;" at the top of the
script,
> I can't compile:
> tompoe@aether:~/perlStuff > createpng
> Global symbol "$im" requires explicit package name at ./createpng line 5.
> Global symbol "$red" requires explicit package name at ./createpng line 7.
> Global symbol "$im" requires explicit package name at ./createpng line 7.
> Global symbol "$blue" requires explicit package name at ./createpng line
8.
> Global symbol "$im" requires explicit package name at ./createpng line 8.
> Global symbol "$im" requires explicit package name at ./createpng line 11.
> Global symbol "$blue" requires explicit package name at ./createpng line
11.
> Global symbol "$im" requires explicit package name at ./createpng line 13.
> Global symbol "$red" requires explicit package name at ./createpng line
13.
> Global symbol "$im" requires explicit package name at ./createpng line 19.
> Execution of ./createpng aborted due to compilation errors.
>
> So, since we're here, do you understand what the message is?  A required
> explicit package name?  I'm lost.  Thanks, Tom
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stupid question...

2001-10-26 Thread Rex Arul

Daniel,

If your OS is Windows, then try the Perl Development Kit of Activestate
Corp, which enables you to produce EXEs, DLLs, etc

http://www.activestate.com


- Original Message -
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 8:28 PM
Subject: Stupid question...


Hey List,

This may sound like the stupidest question so far but, I was wondering
the other day is it possible for perl programs (script.pl) to be
compiled like a C/C++ programs are?  I can't really find any
documentation on this so I thought I figured I would ask some one here.

Regards,

Daniel Falkenberg

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stupid question...

2001-10-26 Thread Rex Arul

Daniel,

If your OS is Windows, then try the Perl Development Kit of Activestate
Corp, which enables you to produce EXEs, DLLs, etc

http://www.activestate.com


- Original Message -
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 8:28 PM
Subject: Stupid question...


Hey List,

This may sound like the stupidest question so far but, I was wondering
the other day is it possible for perl programs (script.pl) to be
compiled like a C/C++ programs are?  I can't really find any
documentation on this so I thought I figured I would ask some one here.

Regards,

Daniel Falkenberg

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stupid question...

2001-10-26 Thread Rex Arul

Daniel,

If your OS is Windows, then try the Perl Development Kit of Activestate
Corp, which enables you to produce EXEs, DLLs, etc

http://www.activestate.com


- Original Message -
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 8:28 PM
Subject: Stupid question...


Hey List,

This may sound like the stupidest question so far but, I was wondering
the other day is it possible for perl programs (script.pl) to be
compiled like a C/C++ programs are?  I can't really find any
documentation on this so I thought I figured I would ask some one here.

Regards,

Daniel Falkenberg

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stupid question...

2001-10-26 Thread Rex Arul

Daniel,

If your OS is Windows, then try the Perl Development Kit of Activestate
Corp, which enables you to produce EXEs, DLLs, etc

http://www.activestate.com


- Original Message -
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 8:28 PM
Subject: Stupid question...


Hey List,

This may sound like the stupidest question so far but, I was wondering
the other day is it possible for perl programs (script.pl) to be
compiled like a C/C++ programs are?  I can't really find any
documentation on this so I thought I figured I would ask some one here.

Regards,

Daniel Falkenberg

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stupid question...

2001-10-26 Thread Rex Arul

Daniel,

If your OS is Windows, then try the Perl Development Kit of Activestate
Corp, which enables you to produce EXEs, DLLs, etc

http://www.activestate.com


- Original Message -
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 8:28 PM
Subject: Stupid question...


Hey List,

This may sound like the stupidest question so far but, I was wondering
the other day is it possible for perl programs (script.pl) to be
compiled like a C/C++ programs are?  I can't really find any
documentation on this so I thought I figured I would ask some one here.

Regards,

Daniel Falkenberg

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Spam

2001-10-26 Thread Rex Arul

Dear Friends,

My email server has gone crazy, as it is keeping on sending an email that I
had sent just once! I am very sorry for a spam that is happening without
my knowledge and control.

Sorry,
Rex


- Original Message -
From: "Rex Arul" <[EMAIL PROTECTED]>
To: "Daniel Falkenberg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 8:56 PM
Subject: Re: Stupid question...


> Daniel,
>
> If your OS is Windows, then try the Perl Development Kit of Activestate
> Corp, which enables you to produce EXEs, DLLs, etc
>
> http://www.activestate.com
>
>
> - Original Message -
> From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 26, 2001 8:28 PM
> Subject: Stupid question...
>
>
> Hey List,
>
> This may sound like the stupidest question so far but, I was wondering
> the other day is it possible for perl programs (script.pl) to be
> compiled like a C/C++ programs are?  I can't really find any
> documentation on this so I thought I figured I would ask some one here.
>
> Regards,
>
> Daniel Falkenberg
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: sort

2001-10-29 Thread Rex Arul

$a and $b are built-in variables used for 'comparison criteria' during the
sort process.

The statement you have posited means that the contents of @files be sorted
alphabetically. The sorting criterion is spelled by $a cmp $b statement.
What this does is to return a 0 if both the candidates are alphabetically
the same, -1 if one is alphabetically lesser than the succeeding element and
1 if the preceding element is alphabetically greater than the succeeding
element.

- Rex

- Original Message -
From: "nafiseh saberi" <[EMAIL PROTECTED]>
To: "perl" <[EMAIL PROTECTED]>
Sent: Monday, October 29, 2001 4:52 AM
Subject: sort


hi.
what is the main work of {$a cmp $b}  in  this code :
@articles = sort {$a cmp $b} @files;
thx
__
Best regards . Nafiseh Saberi
  A bird in the hand ,is worth two in the bush.
  www.iraninfocenter.net
   www.sorna.net
___




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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

2001-10-29 Thread Rex Arul

Stefan,

The 'Schwartzian Transform' usually is a good approach for such cases. It is
not very difficult as it seems to be (Thanks to http://5sigma.com of Joseph
Hall). Please follow the comments and it should be pretty straightforward:

Cheers,
Rex


#!/usr/bin/perl
use strict;
my(@listOfFiles) = <*>;
#Using Schwartzian Transform (Read from Bottom-to-top)
#a) Get the file names and its modification date
#b) Sort the files based on -M (Age of files since script started).
# This will put the latest files to the top of the stack
#c) Slash the contents to @sortedFiles array
my(@sortedFiles) = map{[$_->[0], $_->[1]]}
  sort{$a->[1] <=> $b->[1]}
  map {[$_,-M $_]}
  @listOfFiles;
foreach(@sortedFiles){
 print "$_->[0]\t\t=> $_->[1]\n";
}


- Original Message -
From: "Dolfen, Stefan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 29, 2001 3:16 AM
Subject: newbie : how to find the latest file in a directory


> Hello,
>
> how can I find the latest file in a directory ?
>
> thanks,
> Stefan
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Persisting Values Across Method Calls

2001-10-29 Thread Rex Arul

Friends,

How can I persist values across method calls, without using Global
Variables? IS there kind of "static" variables and if so can any of you
provide a simple code example to prove the point?

Thanks in advance,
Rex




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Activ state Perl Dev Kit

2001-11-09 Thread Rex Arul

Yes, I do. I have created many EXEs and DLLs using Perl Dev Kit. However,
for some standalone exes, it was kludgy. But most other times, it was fine.
The other problem with building freestanding EXEs using PDK is the large
size of the EXE, which on the average amounts to 1.6-1.8 MB for a simple
Perl Script.

-- Rex

- Original Message -
From: "Martin Pfeffer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 4:11 AM
Subject: Activ state Perl Dev Kit


> does anywone has experience about Activ state Perl Dev Kit?
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: calling Win32 API???

2001-11-09 Thread Rex Arul

I am sorry for not being clear.

The main API you need to interface with Win32API is the Win32 Module.

To deal with Windows Registry, you have to use Win32::TieRegistry module.

To deal with Windows Services, you have to use Win32::Service module.

If you want to perform Windows NT network administration stuff, you can use
Win32::NetAdmin and Win32::NetResource modules, which I think comes by
default installation of Perl. Howerver, Win32::Lanman module is very
powerful and is not available with PPM. You have to go to
http://www.roth.net or search on google for Win32::Lanman. That module as
well as Win32::NetAdmin and Win32API::Net interface with Windows NT
Lanmanager.

Just go through the documentation of Win32 and Win32API to find lots of
interesting things that you can do.

Thanks,
Rex

- Original Message -
From: "Abhra Debroy" <[EMAIL PROTECTED]>
To: "Arul, Rex" <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 4:30 AM
Subject: RE: calling Win32 API???


> Hi Rex
> That's a good information. Recently I was trying to use windows API in my
> perl program. I was using only win32 and win21Api module. I am able to use
> certain API successfully while some API was not getting called with out
any
> reason. It may be due to that I was not using all the module u mentioned.
>
> Do u mean to say that for successful use of windows API I have to use all
> the API ?
>
> Thanks
>
> Abhra Debroy
> Prabodhan Exports Pvt. Ltd.(www.prabodhan.com - Join our QA Club!)
> Tel: 91-20-5462035,543 1447( Extn -25)
>
>
> > -Original Message-
> > From: Arul, Rex [SMTP:[EMAIL PROTECTED]]
> > Sent: Friday, November 09, 2001 3:19 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: Re: calling Win32 API???
> >
> > use Win32;
> > use Win32API;
> > use Win32::OLE;
> > use Win32::Lanman;
> > use Win32::NetAdmin;
> > use Win32::AdminMisc;
> >
> > You need to install the last 3 modules via ppm, whereas the first three
> > come by default installation of perl on Win32 (Activestate Perl).
> >
> > -- Rex
> >
> >
> > nerd wrote:
> >
> > >hi all,
> > >
> > >I want to invoke win32 API calls in my perl programs. Where can i find
> > the
> > >documentation for this? i searched the perldoc.com, but no use. what i
am
> > >trying to do is to use the win32 API functions like "FindFirst()"
> > >"FIndLast()". and i dont seem to see the documentation of these
anywhere?
> > >
> > >can anyone help me with this?
> > >
> > >thanx in advance
> > >
> > >::aky
> > >
> > >p.s. or atleast where i can find the docs for win32 module of perl?
> > >
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Duplicates in 2D Array

2001-11-09 Thread Rex Arul

Andrea,

Even if you do have commified strings, it should still work. Right?

###
use strict;
my(@array, @unique, %seen);
$array[0] = ["apples","oranges","plums", "Arul, Rex", "Holstein, Andrea",
"Clinton,Bill"];
$array[1] = ["asparagus", "corn","peas"];
$array[2] = ["ham","chicken","lamb"];
$array[3] = ["apples","oranges","plums", "Arul, Rex", "Holstein, Andrea",
"Clinton,Bill"];
my @unique = grep {!$seen{join (", ", @$_)}++} @array;
map { print "@$_ \n" } @unique;
##

Here is the output:

C:\Perl\Rex>perl testunique.pl
apples oranges plums Arul, Rex Holstein, Andrea Clinton,Bill
asparagus corn peas
ham chicken lamb





>
> Why dirty?
> I simply join all entries in every array with a ", ".
> It's not general that in strings aren't commata :-)
>
> Best Wishes,
> Andrea
>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




To Objects or Not is the Question

2001-11-10 Thread Rex Arul

Dear Friends,

I was just going through Object Oriented Programming in Perl by Damian
Conway in the bookstore yesterday. In the introductory pages, Damian had
noted that empirically it is noticed that subroutines invoked in Objects are
20-50% sluggish than normally written Perl subroutines. Of course, when the
project code assumes monstrous proportions with several thousands of lines,
Object Oriented approach is the way to go.

I am just wondering if Object Oriented Perl programming is being resorted to
many of you in this mailing-list (despite the performance penalty), so that
I can get a feel for how it is used in pragmatic  sense against the pros of
using it as proclaimed in various Perl books.

a) traditional sequential script programming, of course, with a good level
of partitioning logic with various subroutines avoiding global variables to
the least,
b) use judiciously the power of packages/modules (with exporting variables,
subroutines etc)
c) use object oriented approach with a performance penalty of 20-50% as
claimed by Damian?

Thanks,
Rex



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: sub-routine help needed.

2001-11-16 Thread Rex Arul


Or even just putting "$count" as the last statement should do the trick as
that is the last scalar assignment in a subroutine that automatically gets
returned.

-- Rex

- Original Message -
From: "Jos I. Boumans" <[EMAIL PROTECTED]>
To: "MerryChristmas!" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, November 16, 2001 4:04 AM
Subject: Re: sub-routine help needed.


> > Sigh ! My mind simply refuses to work. What must I do to print the
number
> of
> > records $count in line 3.
> > Thanks
> >
> >
> > 1.@array = qw ( hello world hello how are you );
> > 2.$match = 'HEllo';
> > 3.print "Your search for $match returns $subroutine $count
> > records\n";
>
> > $subroutine = &count;
> > sub count {
> > foreach $record (@array){
> >  if (grep /$match/i, $record) {
> > print $record;
> > $count++;
> > };
> > };
> ### add this:
> return $count;
>
> > };
> >
> >
>
> you simply 'return' what you want to return ;)
> try 'perldoc -f return'
>
> hth, Jos
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: get current dir

2001-11-16 Thread Rex Arul


Quick Reply: If you are in Windows OS, this would work:

perl -e "use Win32; print Win32::GetCwd();"


- Original Message - 
From: "Pradeep Sethi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 16, 2001 8:23 PM
Subject: get current dir


> what is the function in perl that returns current dir ?
> 
> Thanks
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: get current dir

2001-11-16 Thread Rex Arul

This is what I get. Is there a function Cwd?

C:\WINDOWS>perldoc -f Cwd
No documentation for perl function `Cwd' found


- Original Message - 
From: "Michael Fowler" <[EMAIL PROTECTED]>
To: "Pradeep Sethi" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, November 16, 2001 8:34 PM
Subject: Re: get current dir


> On Fri, Nov 16, 2001 at 05:23:19PM -0800, Pradeep Sethi wrote:
> > what is the function in perl that returns current dir ?
> 
> see perldoc Cwd
> 
> 
> Michael
> --
> Administrator  www.shoebox.net
> Programmer, System Administrator   www.gallanttech.com
> --
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: problem in the #/usr/local/bin line

2001-11-17 Thread Rex Arul

1) The shebang line of #!usr/local/bin/perl has nothing to do with your
woes.

2) If you had installed ActiveState Perl, it would have automatically
installed the PerlScript plugins and other ISAPI filters that you might need
to code your ASP Pages in Perl.

3) If you want to run your Perl Scripts as CGI, then you need to modify a
registry key. Even that would have been automatically configured by the
Activestate Perl's installation. If you had missed it, or if you have any
other Perl installed other than ActiveSTate, then do this:


http://support.microsoft.com/support/kb/articles/Q245/2/25.ASP?LN=EN-US&SD=g
n&FR=0&qry=perl&rnk=8&src=DHCS_MSPSS_gn_SRCH&SPR=IIS

You are now all set to execute Perl CGIs in PWS.

-- Rex


- Original Message -
From: "Karthik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 17, 2001 6:57 AM
Subject: problem in the #/usr/local/bin line


> My Problem:
>
> I run a web server(PWS) on a Windows 98 machine. My
> perl.exe(perl interpreter) is located in
> c:\root\perl\bin. My files(web
> pages etc..) are located in c:\root. Since each perl
> program needs the "
> #!/usr/local/bin/perl " line at the start I dont know
> what to put in that
> line since the above line can be used only in Unix.
> Since I have a
> Windows machine my web server doesn't read that line
> and thus fail's to show
> the file. Thus i am forced not to use Perl. I need
> Perl since it is very
> lucid.
>
> Thus I want to know what should i put instead of the
> usual "
> #!/usr/local/bin/perl " line because that is not
> recognized by the web
> server. this is obviously due to the fact that i use
> Windows and not Unix.
>
> I have Perl 5 installed on my computer.
>
> I am eagerly awaiting your reply.
>
> =
>
> Hi and Ho!! This message is from Karthik.
>
> Visit my site at http://in.members.tripodasia.com/karthik_immortal
>
>
>
>
> __
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: problem in the #/usr/local/bin line

2001-11-17 Thread Rex Arul

Windows Does not care for the shebang line.

Personal Web Server / IIS 4.0 / IIS 5.0 / Standalone Perl Scripts in
Windows -- They all don't care what the shebang line is. They just ignore
it.

The only place that I know the shebang line does matter in Windows is that
if you use APACHE Server to serve CGIs, you have to have the shebang line,
even in Windows.

If your perl.exe is located in c:/perl/bin, then if you code your CGI in
Apache, you should have the first line of the CGI as

 #!c:/Perl/bin/Perl

-- Rex

- Original Message -
From: "Karthik Krishnamurthy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 17, 2001 8:55 AM
Subject: Re: problem in the #/usr/local/bin line


> the #!/file/to/interpreter
> line is not specific to perl, but to unix. so look for
> something else under windows.
>
> /kk
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Win32::OLE, or maybe POP3Client Module??

2002-01-23 Thread Rex Arul


Try Mail::POP3Client module, available from the PPM Repository of
Activestate.

- Rex

- Original Message -
From: "Chris Zampese" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 23, 2002 10:49 PM
Subject: Win32::OLE, or maybe POP3Client Module??


> Hello everyone!
>I am still trying to read the subject line of all messages in my
Outlook
> Express Inbox.  I know that this is possible using VB SCript - microsoft
> provides comprehensive tutorials in their suppport pages, but I cannot
seem
> to get it to run in Perl.
>I thought that maybe it would be possible to capture the email straight
> from the POP server, Anyone know whether this is possible???
>Once again I am extremely grateful and indebted to you all for any
help,
>Thanks,
> Chris.
>
>
>
> _
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: sending email - Mail::Sender and Mail::Sendmail

2002-01-25 Thread Rex Arul

> Well I'm just wondering if there is much difference between Sender and
> Sendmail:
>

I guess, the simplicity of sending mail attachments is laudable with
Mail::Sender, whereas you have to work out a  bit more in Mail::Sendmail to
make attachments work!

The same reason behooves well for sending HTML mails too, which is pretty
straightforward with Mail::Sender.

-- Rex



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]