Accessing HTTPS pages of bank account with login and passwords

2003-09-05 Thread Arthur Billingsley
JAPH wants to get banking data daily.
I have looked through LWP info but do not fully
understand use. I have been looking for examples
but no success.
How do I get this done?

Pseudo:
Load Modules ??
Define/Declare objects

Goto HTTPS with $username, $password and $pin ?? HOWTO please
Parse HTML for data

Write data to file # Easy part
Logoff/close HTTPS ??
Cleanup environment
Any help is greatly appreciated. TIA

Art

Norfolk, Virginia



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


Re: [Addendum] Stripping HTML from a text file.

2003-09-05 Thread Octavian Rasnita
It doesn't work because you check for the beginning and the end head tags
in the same line, but you have splitted the text in more lines, and the
head can be found in a line but the /head tag on another line probably.


You can use something like this:

$html =~ s|head[^]*.*?/head[^]*||si;

So you don't need to check each line separately.

It works for the  head tag but it doesn't work for all the tags, because you
might have a page like this:

table
trtda1/td
tda2/td
tda3/td/tr
trtdb1/td
td
table
...
/table
/td
tdb3/td/tr
/table

If you will want to delete everything from table until its corresponding
/table it is more complicated because if you will use that simple regular
expression it will delete until the first /table but not until the second
one.


- Original Message - 
From: Sara [EMAIL PROTECTED]
To: Sara [EMAIL PROTECTED]; Hanson, Rob [EMAIL PROTECTED];
'Wiggins d'Anconia' [EMAIL PROTECTED]
Cc: beginperl [EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 4:08 PM
Subject: [Addendum] Stripping HTML from a text file.


 Okay, when I finally implemented this, again its not working ... any
ideas?
 simple regex like s/head/blah/g; is working but not this one?

 
 #!/usr/bin/perl

 use LWP::Simple;

 print Content-type: text/html\n\n;

 $url = 'http://yahoo.com';

 $html = get($url);

 @html = split(/\n/,$html);

 foreach $line(@html) {

 chomp ($line);

 $line =~ s|head.*?\/head||s;

 print $line\n;

 }
 #



 Thanks for any input.

 Sara.



 - Original Message -
 From: Sara [EMAIL PROTECTED]
 To: Hanson, Rob [EMAIL PROTECTED]; 'Wiggins d'Anconia'
 [EMAIL PROTECTED]
 Cc: beginperl [EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 4:34 PM
 Subject: Re: Stripping HTML from a text file.


 : Thanks a lot Hanson,
 :
 : It worked for me.
 :
 : Yep, you are right The regex way is good for quick and dirty HTML
work.
 :
 : and especially for the newbies like me :))
 :
 : Sara.
 :
 :
 : - Original Message -
 : From: Hanson, Rob [EMAIL PROTECTED]
 : To: 'Wiggins d'Anconia' [EMAIL PROTECTED]; 'Sara'
 : [EMAIL PROTECTED]
 : Cc: beginperl [EMAIL PROTECTED]
 : Sent: Friday, September 05, 2003 5:55 AM
 : Subject: RE: Stripping HTML from a text file.
 :
 :
 : :  Or maybe I misunderstood the question
 : :
 : : Or maybe I did :)
 : :
 : :  HTML::TokeParser::Simple
 : :
 : : I agree... but only if you are looking for a strong permanant
solution.
 : The
 : : regex way is good for quick and dirty HTML work.
 : :
 : : Sara, if you need to keep the head tags, then you could use this
 : modified
 : : version...
 : :
 : : # untested
 : : $text = ...;
 : : $text =~ s|(head).*?(/head)|$1$2|s;
 : :
 : : ...Or if you wanted to keep the title tag...
 : :
 : : # untested
 : : $text = ...;
 : : $text =~ s|(head).*?title.*?/title.*?(/head)|$1$2$3|s;
 : :
 : : Rob
 : :
 : : -Original Message-
 : : From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
 : : Sent: Thursday, September 04, 2003 8:48 PM
 : : To: 'Sara'
 : : Cc: beginperl
 : : Subject: Re: Stripping HTML from a text file.
 : :
 : :
 : : Won't this remove *everything* between the given tags? Or maybe I
 : : misunderstood the question, I thought she wanted to remove the code
 : : from all of the contents between two tags?
 : :
 : : Because of the complexity and variety of HTML code, the number of
 : : different tags, etc. I would suggest using an HTML parsing module for
 : : this task. HTML::TokeParser::Simple has worked very well for me in the
 : : past.  There are a number of examples available. If this is what you
 : : want and you get stuck on the module then come back with questions.
 : : There are also the base modules such as HTML::Parser, etc. that the
one
 : : previously mentioned builds on, among others check CPAN.
 : :
 : : http://danconia.org
 : :
 : : Hanson, Rob wrote:
 : :  A simple regex will do the trick...
 : : 
 : :  # untested
 : :  $text = ...;
 : :  $text =~ s|head.*?/head||s;
 : : 
 : :  Or something more generic...
 : : 
 : :  # untested
 : :  $tag = head;
 : :  $text =~ s|$tag[^]*?.*?/$tag||s;
 : : 
 : :  This second one also allows for possible attributes in the start
tag.
 : You
 : :  may need more than this if the HTML isn't well formed, or if there
are
 : : extra
 : :  spaces in your tags.
 : : 
 : :  If you want something for the command line you could do this...
 : : 
 : :  (Note: for *nix, needs modification for Win [untested])
 : :  perl -e '$x=join(,);$x=~s|head.*?/head||s' myfile.html 
 : :  newfile.html
 : : 
 : :  Rob
 : : 
 : : 
 : :  -Original Message-
 : :  From: Sara [mailto:[EMAIL PROTECTED]
 : :  Sent: Wednesday, September 03, 2003 6:32 AM
 : :  To: beginperl
 : :  Subject: Stripping HTML from a text file.
 : : 
 : : 
 : :  I have a couple of text files with html code in them.. e.g.
 : : 
 : :  -- Text File --
 : :  html
 : :  head
 : :  titleThis is Test File/title
 : 

RE: Perl on the web?

2003-09-05 Thread Bob Showalter
Dawn Bradshaw wrote:
 Hi!
 
 Does anyone have experience with making a perl script run on the web?
 Specifically, I'm having trouble collecting the answers the users give
 on the web page and incorporating them into the script.  The script
 itself runs fine on the web server.
   Any suggestions, advice or help would be greatly appreciated!

1. Use the beginners-cgi list for this.

2. Supply more details. What environment are you running in? What is the
trouble you're having. Error messages, unexpected behavior, don't know how
to configure the  web server to run your script?

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



submit a form with javascript?

2003-09-05 Thread wendy soros
Dear All,

I am new to LWP and Perl, but I need them to extract
data from a website where I fill in some search
parameters and the website returns links to the actual
text I need. Since I am searching data of a long list
of companies, I want to automate the process with
Perl. 

From the html source code of the search page, I can
get the pairs of name-value of the parameters I need.
The problem is it doesn't have a pair for submitting
the form. Instead, it seems to use javascript to do
this, which I have no idea about. Could anyone tell me
how to submit the form using javascript, or at least
point me to some references I can read myself?

Here is the part of the html source code of the search
page I think is relavent:


SCRIPT LANGUAGE=JavaScript TYPE=text/javascript
   
SRC=/universe/media/jscript/suite/form_js_utils.v1.js
/SCRIPT


INPUT TYPE=hidden NAME=formSubmit VALUE= 
INPUT TYPE=hidden NAME=imageSubmit VALUE= 
a href=
onClick=submitForm(document.forms[0],'Search');return
false;IMG
SRC=/universe/media/images/suite/search_gray.gif
ALT=Search WIDTH=58 HEIGHT=20
BORDER=0//anbsp;nbsp; 
a href=
onClick=submitForm(document.forms[0],'Clear
Form');return false;IMG
SRC=/universe/media/images/suite/clearform_gray.gif
ALT=Clear Form WIDTH=82 HEIGHT=19
BORDER=0//a 
nbsp; /td
/tr
  /table
div align=centercenter


Thank you very much!
Best,
Wendy



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: Stripping HTML from a text file.

2003-09-05 Thread Randal L. Schwartz
 Sara == Sara  [EMAIL PROTECTED] writes:

Sara I have a couple of text files with html code in them.. e.g.
Sara -- Text File --
Sara html
Sara head
Sara titleThis is Test File/title
Sara /head
Sara body
Sara font size=2 face=arialThis is the test file contentsbr
Sara p
Sara blah blah blah.
Sara /body
Sara /html

Sara -

Sara What I want to do is to remove/delete HTML code from the text file from a 
certain tag upto certain tag.

Sara For example; I want to delete the code completely that comes in between head 
and /head (including any style tags and embedded javascripts etc)

Sara Any ideas?

This code will create an XML tree doc from stdin, and write the modified
version to stdout, deleting everything from the /html/head node
downward:

use XML::LibXML;
my $p = XML::LibXML-new or die;
$p-recover(1);
my $d = $p-parse_html_fh(\*STDIN) or die;
$_-unbindNode for $d-findnodes(/html/head);
print $d-toStringHTML();

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



tcpdump to a perl script

2003-09-05 Thread ROBERT_MCCAMMON
Hi all.

This may be very simple, however I am missing something.  I want to pipe
information into a perl script.  Yet, I can not figure out what type of
system variable it will use.  $_ , @_ , or even %_.

The program is going to pipe the information into a PERL script which in
turn will use a regular expression to extract the various parts of data.
The parsing is not so much the issue, getting the variables in the first
place is defying me.  Can anyone answer this (probably) simple question?

My thanks in advance,

Robert McCammon
Senior Network Administrator (DMTN)
North American Information Technologies Systems


Re: tcpdump to a perl script

2003-09-05 Thread drieux
On Friday, Sep 5, 2003, at 07:45 US/Pacific, 
[EMAIL PROTECTED] wrote:
[..]
This may be very simple, however I am missing something.  I want to 
pipe
information into a perl script.  Yet, I can not figure out what type of
system variable it will use.  $_ , @_ , or even %_.
do you mean pipe as in

	./some_cmd | ./my_perl_code.plx

what you will be reading in that case is from STDIN as in

while(STDIN) {
# read the stuff in $_ if line oriented
}
otherwise you will want to do the standard sysread().
read the perldoc on these - my handy dandy, test my
side of the pipe template is found at:
	http://www.wetware.com/drieux/pbl/perlTrick/drieuxTemplates/DoCmd.txt

This way I can work out the basic semantics for what most of
the cases of
	foo | bar

will work out to be...

or do you mean pipe as in

pipe(CHLDr, PRNTw);
pipe(PRNTr, CHLDw);
if (!($pid = fork())) {
open(STDIN, CHLDr);
open(STDOUT, CHLDw);
open(STDERR, CHLDw);
close(PRNTw); close(PRNTr); #close(DTKERRr);
select(STDOUT) ; $|=1 ;
exec( $CMD 21);
exit;
}
#
# we are the parent side of the process
#
select(PRNTw); $|=1; select(STDOUT);
close(CHLDr); close(CHLDw); #close(DTKERRw);
which again is a matter of reading the end of the pipe
that is your end, and writing to the end of the pipe that
you are ACKing on...
Since I am a DILBERT I of course do the funk like that
so I remember, me Parent, Me write on PRNTw, Me Read from CHLDr
and then simplify my world by resetting stderr to stdout...
ciao
drieux
---

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


File existence under Microsoft IIS

2003-09-05 Thread Mike
Hello,

I have been trying a number of ways to determine whether a file exists in a particular 
directory, but to no avail.
The perl books I have (and many web sites/forums I have checked) mention the '-e' test 
on a filehandle or filename, but it returns false (the file does not exist) even if it 
does.  I have used code such as:

if (-e 'filepath/filename') { # using absolute naming with full pathname etc.
  # display the file (image) in the HTML output
}

and

if (-e $filepath/$filename) { # using variables as the path and name information
  # display the file
}

and

if (open(TMP, $filepath/$filename)) { # to test whether the file can be opened
# I would expect a false (or undef) if the file did not exist
  # display the file
}

I commented out the if statement (and closing brace '}' ), and manually set the file 
to be displayed, and it worked.  That was to check that the path  filename were 
correct.  I would like to be able to display the image if it exists, or display 
another 'image does not exist' image if the image file does not exist.

I have even tried the 'use File::stat' module methods.

I do not get any fatal errors - the rest of the HTML output works fine - just no image 
displayed even though I know the filepath  name do indeed exist.  Am I missing 
something obvious?  The only thing I can think of at this stage is that the -e test 
(and related file tests) are for Unix-based servers and I am running from a MS 
IIS-based server.  But if that were the case, wouldn't the server spit out an error 
that it didn't understand -e?  Are there similar (but different) file tests for IIS?

Thanks in advance,
Mike.




Re: passing an argument to a subroutine

2003-09-05 Thread Todd W.

B. Fongo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello

 An argument passed to a subroutine returns wrong value.

 Code example:

 @x = (1..5);
 $x = @x;


here, $x gets the number of elements in @x


 showValue ($x);   # or showValue (\$x);


 sub showValue {

   my $forwarded = @_;


$forwarded gets the number of elements in @_


   print $forwarded;  # print ${$forwarded};

 }

 In both cases, the script prints out 1.
 What is going on here?


What do you expect to happen? What _is_ happening is exactly what is
supposed to.

Todd W.



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



Re: reverse range (10..1)

2003-09-05 Thread R. Joseph Newton
Paul Archer wrote:

 4:09pm, Ramprasad A Padmanabhan wrote:

 And the problem is not simply a puzzle, nor is it homework. If you had read
 my post more carefully, you would see that I am 1) *teaching* the class, and
 2) want to be able to show off one concept (the range operator) before we
 have talked about another concept (the 'reverse' statement).

Even more reason, if you are in the position of a teacher, not to use the range
operator for this purpose.  It is simply inappropriate.  Unless there is only a
certain subset of elements in the array for which you want to do magic, the foreach
(@array_name) format communicates intent much more clearly.

I'm a little surprised that no one has yet posted what seems to me the most direct
and transparent soltion:  [note the sample does make use of the range operator in a
more appropriate context]

Greetings! E:\d_drive\perlStuffperl -w
my @keeper = (1..15);
{
  my @temp;
  push @temp, pop @keeper while @keeper;
  @keeper = @temp;
}
print $_  for @keeper;
^Z
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

I like the above because:

1.  It is transparent. You can see the data being moved.
2.  It is process efficient.  Each element is moved only once, and an array name is
redirected.  It does what it takes--no more and no less.
3.  It minimizes memory demands painlessly.  The original storage for @keeper is
returned to the store when it is re-assigned, and @temp disappears entirely outside
the {...} closure, leaving @keeper pointing to the reversed array.

Hmmm...

On second thought, I'm not sure about process efficiency here, Perl may re-copy the
whole array in the assignment.  In which case, the more efficient and elegant
solution would use references:

Greetings! E:\d_drive\perlStuffperl -w
my $keeper = [1..15];
{
  my $temp = [];  #  = []  Not strictly neccesary.  The first push() would
autovivify @$temp
  push @$temp, pop @$keeper while @$keeper;
  $keeper = $temp;
}
print $_  for @$keeper;
print \n;
^Z
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

As a side exercise, you might have your students add the implicit parens.

Joseph



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



Equivalent of GetVersionInfo ()

2003-09-05 Thread Shishir Saxena
Hi,

Is there a way to get the information returned by the VC++ fn
GetVersionInfo( ); thru any of the perl structures / commands ?
PS : If this is too easy a question...plz pardon my ignorance but I'm really
new to perl !

Regards,
Shishir Saxena




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



RE: Equivalent of GetVersionInfo ()

2003-09-05 Thread Charles K. Clarkson
Shishir Saxena [EMAIL PROTECTED] wrote:

: Is there a way to get the information returned by the VC++ fn
: GetVersionInfo(); thru any of the perl structures / commands?

What does GetVersionInfo() return?


Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328


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



RE: Equivalent of GetVersionInfo ()

2003-09-05 Thread Shishir Saxena
Hi,

It reads the resource of the file on which the function is used on and it
returns a 
collective string that has everything that is part of the resource like,
copyright info,
build number (if a components or executable), date of creation etc. I intend
to
then creat a log of that information.



-Original Message-
From: Charles K. Clarkson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 12:58 PM
To: 'Shishir Saxena'; [EMAIL PROTECTED]
Subject: RE: Equivalent of GetVersionInfo ()


Shishir Saxena [EMAIL PROTECTED] wrote:

: Is there a way to get the information returned by the VC++ fn
: GetVersionInfo(); thru any of the perl structures / commands?

What does GetVersionInfo() return?


Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328

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



split large array into chunks

2003-09-05 Thread Ramprasad A Padmanabhan
Hello all,

 Suppose I have a huge array of filenames and I want to move them
I would like to  move 1 chunk at a time on 'n' elements
How Can I efficiently do it ?

something like

@allfiles  = ()   # 1 files
@smallchunks = split_to_chunks(@allfiles,100);
 #  This function is what I want to write
foreach (@smallchunks) {
 my $filelist = join( ,@{$_});

.   
}
Thanks
Ram


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


REPOST - print c:\program files\*.*;

2003-09-05 Thread Edward Yang
I'm not sure if this is a bug.

I'm running Perl 5.8 on a Windows 2000 Pro system (with SP4 and all latest
hotfixes installed).

Running perl -v  I get:
This is perl, v5.8.0 built for MSWin32-x86-multi-thread

~~

The problem is I do not get correct result from the following code:
print c:\program files\*.*;
or
print c:\\program files\\*.*;

I get only one line of output text:
c:./program

I'm a beginner on Perl, though I've written several scripts manipulating Web
sites and managing downloads. I wonder if it is a bug on Windows system or
I'm doing something wrong.

Thanks.

Edward




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



how to decode encoded characters

2003-09-05 Thread Ramprasad A Padmanabhan
Hi all,

When I use Mail::IMAPClient I am getting charachters encoded in the 
following way
=?iso-8859-1?q?EDM=
How Can I decode them

Ram

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


reset a file pointer

2003-09-05 Thread Sachin Mathur
Hi , 
 I am a beginner in perl I would like to know how to reset a file
pointer in perl. Is their a rewind command in perl
 
 
Sachin


Re: reset a file pointer

2003-09-05 Thread Paul Johnson

Sachin Mathur said:
 Hi ,
  I am a beginner in perl I would like to know how to reset a file
 pointer in perl. Is their a rewind command in perl

No.  Use seek()

perldoc -f seek

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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



Re: reset a file pointer

2003-09-05 Thread Tassilo von Parseval
On Fri, Sep 05, 2003 at 03:25:46PM +0530 Sachin Mathur wrote:
 Hi , 
  I am a beginner in perl I would like to know how to reset a file
 pointer in perl. Is their a rewind command in perl

Yes, it's called seek():

use Fcntl qw/:seek/;

seek FILE, 0, SEEK_SET;

The first line is only for importing the SEEK_* constants for the sake
of portability. See 'perldoc -f seek'.

Tassilo
-- 
$_=q#,}])!JAPH!qq(tsuJ[{@tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?=sub).+q#q!'qq.\t$.'!#+sexisexiixesixeseg;y~\n~~;eval


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



perl questions / exercices

2003-09-05 Thread Ged
Hi all,

I am currently learning perl reading all the material I can get my hands on, but have 
no use for it on a daily basis.

Because of this I am not getting the practice I need on a day-to-day basis to gain 
more knowledge.

Having covered all the questions in books like 'Learning Perl' etc I need more 
exercises, if not small projects to further my skills.

Its not easy to think up usefull projects, so my question is, does anybody know of 
anything on the net to challenge me 

Thanks,

Ged.

(p.s. I am still in the early stages so long complicated projects are still a little 
out of my reach at the moment.)

-
Email provided by http://www.ntlhome.com/



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



RE: perl questions / exercices

2003-09-05 Thread Shishir Saxena
Well since you've asked for it how about doing this,

I want to make a cross-platform utility that when provided with the location
of a directory structure generates the following log,

1) Date of creation
2) Size on Disk
3) Build number of the component / executable.
4) Copyright info (if included in the resource file)


So what do you think ?

-Original Message-
From: Ged [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 3:59 PM
To: [EMAIL PROTECTED]
Subject: perl questions / exercices


Hi all,

I am currently learning perl reading all the material I can get my hands on,
but have no use for it on a daily basis.

Because of this I am not getting the practice I need on a day-to-day basis
to gain more knowledge.

Having covered all the questions in books like 'Learning Perl' etc I need
more exercises, if not small projects to further my skills.

Its not easy to think up usefull projects, so my question is, does anybody
know of anything on the net to challenge me 

Thanks,

Ged.

(p.s. I am still in the early stages so long complicated projects are still
a little out of my reach at the moment.)

-
Email provided by http://www.ntlhome.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]



Perl on the web?

2003-09-05 Thread Dawn Bradshaw
Hi!

Does anyone have experience with making a perl script run on the web?
Specifically, I'm having trouble collecting the answers the users give
on the web page and incorporating them into the script.  The script
itself runs fine on the web server.
  Any suggestions, advice or help would be greatly appreciated!

Dawn B.


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



Re: split large array into chunks

2003-09-05 Thread Jenda Krynicky
From: Ramprasad A Padmanabhan [EMAIL PROTECTED]
   Suppose I have a huge array of filenames and I want to move them I
 would like to  move 1 chunk at a time on 'n' elements
 
 How Can I efficiently do it ?
 
 something like
 
 @allfiles  = ()   # 1 files
 @smallchunks = split_to_chunks(@allfiles,100);
   #  This function is what I want to write
 
 foreach (@smallchunks) {
   my $filelist = join( ,@{$_});
  
  .
 }

my $chunk_size = 100;
for( my $i = 0; $i * $chunk_size = $#allfiles; $i++) {
my $filelist = join(  , @allfiles[$i*$chunk_size .. 
(($i+1)*$chunk_size - 1)]);
...
}

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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



Re: Perl on the web?

2003-09-05 Thread rjtaylor
Quite the open-ended question there, my dear.

What you're looking for is a way to receive data through a web server, most
likely Apache (the most commonly used web server, but any would do), and
manipulate it and then send it out through the web server to the
requesting/submitting web browser, right?

You probably are looking to use CGI - Common Gateway Interface - a common
way to share web server data with a server-side script or program. Perl
interfaces well with CGI, infact there is a rich heritage of Perl use on the
Web for everything from simple CGI scripts to take data entered into a form
a mail it to the form's owner (formmail.pl or formail.pl -- this kind of
script is found at http://nms-cgi.sourceforge.net) to running Amazon.com
(via a version of Perl loaded directly into Apache and much more efficient
than CGI; this is called mod_perl -- the Apache module of Perl).

See the NMS archive for a good beginning to writing simple web form
scripting. Then see the rich repository of Perl modules available for
everything from system-level programming to commercial application
interfacing to Web development at CPAN.org.

Links:

http://nms-cgi.sourceforge.net

http://search.cpan.org


- Original Message - 
From: Dawn Bradshaw [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 05, 2003 4:21 AM
Subject: Perl on the web?


 Hi!

 Does anyone have experience with making a perl script run on the web?
 Specifically, I'm having trouble collecting the answers the users give
 on the web page and incorporating them into the script.  The script
 itself runs fine on the web server.
   Any suggestions, advice or help would be greatly appreciated!

 Dawn B.


 -- 
 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: RE: perl questions / exercices

2003-09-05 Thread Ged
Sounds interesting. I'll give it a whirl.

Hope you won't be waiting for me to code it though as it might take me a while to get 
it running smoothly, esspeically with it being cross platform.

 
 From: Shishir Saxena [EMAIL PROTECTED]
 Date: 2003/09/05 Fri AM 10:33:56 GMT
 To: Ged [EMAIL PROTECTED],  [EMAIL PROTECTED]
 Subject: RE: perl questions / exercices
 
 Well since you've asked for it how about doing this,
 
 I want to make a cross-platform utility that when provided with the location
 of a directory structure generates the following log,
 
 1) Date of creation
 2) Size on Disk
 3) Build number of the component / executable.
 4) Copyright info (if included in the resource file)
 
 
 So what do you think ?
 
 -Original Message-
 From: Ged [mailto:[EMAIL PROTECTED]
 Sent: Friday, September 05, 2003 3:59 PM
 To: [EMAIL PROTECTED]
 Subject: perl questions / exercices
 
 
 Hi all,
 
 I am currently learning perl reading all the material I can get my hands on,
 but have no use for it on a daily basis.
 
 Because of this I am not getting the practice I need on a day-to-day basis
 to gain more knowledge.
 
 Having covered all the questions in books like 'Learning Perl' etc I need
 more exercises, if not small projects to further my skills.
 
 Its not easy to think up usefull projects, so my question is, does anybody
 know of anything on the net to challenge me 
 
 Thanks,
 
 Ged.
 
 (p.s. I am still in the early stages so long complicated projects are still
 a little out of my reach at the moment.)
 
 -
 Email provided by http://www.ntlhome.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]
 
 

-
Email provided by http://www.ntlhome.com/



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



case conversion problem

2003-09-05 Thread Gary Stainburn
Hi folks,

I've got a problem I hope you can help me with.

I've got to tidy some data, including converting case.  I need to convert

ANOTHER COMPANY NAME LTD  **

to

Another Company Name Ltd  **

while retaining spaces.

I've tried using split / join / lc / ucfirst which does most of the work but 
loses the spacings.  

I guess that there's a regex that will do this but I'm at a loss how.

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 


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



please help !! pattern match

2003-09-05 Thread Pandey Rajeev-A19514
Hi ,

I need some help me to extract a pattern. The delimiters is a pair of abcd and 
efgh. Can some one help me with an efficient use of Greedy and non greedy matches, 
look ahead and lookbehind features. 

I want the smallest match involving the two delimiters. I want all the matches. i.e. 
fisrt match , last match and all ther other matches in between. 


Here is what I tried to extract the first match and the results(a bad one) I got.

$abc = END;
aa
abcd a
abcd b
AAA
BBB
efgh c
CCC
efgh d
DDD
EEE
FFF
abcd e
abcd f
GGG
HHH
III
efgh g
efgh h
JJJ
KKK
END

$match = 'abcd(?:(?!abcd).)*efgh.*?\n';
($found) = ($abc =~ /($match)(?!$match)/sxi);
print *\nFOUND FIRST MATCH\n$found\n;

The OUTPUT IS :
*
FOUND FIRST MATCH
abcd b
AAA
BBB
efgh c
CCC
efgh d


WHEREAS I wanted it to be
*
FOUND FIRST MATCH
abcd b
AAA
BBB
efgh c


Any suggestion is welcome.

Thanks in advance.
Rajeev



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



Re: case conversion problem

2003-09-05 Thread James Edward Gray II
On Friday, September 5, 2003, at 08:14  AM, Gary Stainburn wrote:

Hi folks,

I've got a problem I hope you can help me with.

I've got to tidy some data, including converting case.  I need to 
convert

ANOTHER COMPANY NAME LTD  **

to

Another Company Name Ltd  **

while retaining spaces.

I've tried using split / join / lc / ucfirst which does most of the 
work but
loses the spacings.
That's how I would do it.  Just put parenthesis around your split 
pattern and it will return the spaces in its list.  It won't hurt to 
change the case of spaces and when you re-join them it'll be just like 
it was.  You can handle that without me typing out the line, right?  ;)

James

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


Perl script checks for a file

2003-09-05 Thread Anthony J Segelhorst
Does anyone already have a perl script that checks to see if a file exists 
or not a Windows Platform?


Anthony J Segelhorst
Enterprise Systems Management Team
Phone: 937-495-1876
Email: [EMAIL PROTECTED]


This email has been scanned for all viruses by the MessageLabs SkyScan
service.___

Note:  Please update your email address for this user to reflect the
new MeadWestvaco Corporation.  MeadWestvaco employee email addresses
are in the format of [EMAIL PROTECTED] 

This electronic message contains information from MeadWestvaco
Corporation or subsidiary companies, which may be confidential,
privileged or otherwise protected from disclosure.  The
information is intended to be used solely by the recipient(s)
named.  If you are not an intended recipient, be aware that
any review, disclosure, copying, distribution or use of this
transmission or its contents is prohibited.  If you have
received this transmission in error, please notify MeadWestvaco
immediately at [EMAIL PROTECTED]
___

Re: case conversion problem

2003-09-05 Thread Jenda Krynicky
From: Gary Stainburn [EMAIL PROTECTED]
 I've got to tidy some data, including converting case.  I need to
 convert
 
 ANOTHER COMPANY NAME LTD  **
 
 to
 
 Another Company Name Ltd  **
 
 while retaining spaces.

$text =~ s/(\w+)/\L\u$1/g;$y

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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



Undef hash

2003-09-05 Thread Paul Kraus
How can I kill a hash? I don't want to kill the entire hash just one
element.

$hash{key}=value - I just want to remove this one not all of %hash.

Paul Kraus


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



RE: Undef hash

2003-09-05 Thread Marcos . Rebelo
delete($hash{key})

-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 3:29 PM
To: [EMAIL PROTECTED]
Subject: Undef hash


How can I kill a hash? I don't want to kill the entire hash just one
element.

$hash{key}=value - I just want to remove this one not all of %hash.

Paul Kraus


-- 
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: case conversion problem

2003-09-05 Thread Gary Stainburn
On Friday 05 Sep 2003 2:25 pm, Jenda Krynicky wrote:
 From: Gary Stainburn [EMAIL PROTECTED]

  I've got to tidy some data, including converting case.  I need to
  convert
 
  ANOTHER COMPANY NAME LTD  **
 
  to
 
  Another Company Name Ltd  **
 
  while retaining spaces.

 $text =~ s/(\w+)/\L\u$1/g;$y

Thanks Jenda,

BTW, I did get the split/join verysion working - don't know what I'd done 
wrong.

Which method would be quickest?

Eventually, I'll be using this to convert/tidy three years work of customer 
details, which I'm guessing will be extensive.


 Jenda
 = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
 When it comes to wine, women and song, wizards are allowed
 to get drunk and croon as much as they like.
   -- Terry Pratchett in Sourcery

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 


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



Re: case conversion problem

2003-09-05 Thread Paul Johnson

Jenda Krynicky said:
 From: Gary Stainburn [EMAIL PROTECTED]
 I've got to tidy some data, including converting case.  I need to
 convert

 ANOTHER COMPANY NAME LTD  **

 to

 Another Company Name Ltd  **

 while retaining spaces.

 $text =~ s/(\w+)/\L\u$1/g;$y

\L\u  --  isn't perl clever?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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



Re: case conversion problem

2003-09-05 Thread James Edward Gray II
On Friday, September 5, 2003, at 08:52  AM, Gary Stainburn wrote:

On Friday 05 Sep 2003 2:25 pm, Jenda Krynicky wrote:
From: Gary Stainburn [EMAIL PROTECTED]

I've got to tidy some data, including converting case.  I need to
convert
ANOTHER COMPANY NAME LTD  **

to

Another Company Name Ltd  **

while retaining spaces.
$text =~ s/(\w+)/\L\u$1/g;$y
Thanks Jenda,

BTW, I did get the split/join verysion working - don't know what I'd 
done
wrong.

Which method would be quickest?
Running:

#!/usr/bin/perl

use strict;
use warnings;
use Benchmark;

my($text1, $text2) = ('ANOTHER COMPANY NAME LTD') x 2;

timethese( 100, { Search_and_Replace	= '$text1 =~ 
s/(\w+)/\L\u$1/g;',
	  Split_and_Join		= '$text2 = join \'\', map { ucfirst(lc $_) } 
split /(\s+)/, $text2;' } );

__END__

I get:

Benchmark: timing 100 iterations of Search_and_Replace, 
Split_and_Join...
Search_and_Replace:  0 wallclock secs ( 0.93 usr +  0.00 sys =  0.93 
CPU) @ 1075268.82/s (n=100)
Split_and_Join:  2 wallclock secs ( 2.22 usr +  0.00 sys =  2.22 CPU) @ 
450450.45/s (n=100)

So, the search and replace method (Jenda's solution) appears to be much 
faster.

James

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


Find the name of all the function on the system

2003-09-05 Thread Marcos . Rebelo
I need to do some kind of generic log trow my code, this will be used just
in debug mode.

I has sinking something like.

sub prepareLog{
foreach my $functionName (xpto()) {
next if not toLog($functionName);
*$functionName = sub { 
print start: $functionName\n;
my @output = {*$functionName}(@_) if wantarray;
my $output = {*$functionName}(@_) if not wantarray;

print end: $functionName\n;
return wantarray ? @output: $output;
}
}
}

Thanks
Marcos

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



Re: Perl script checks for a file

2003-09-05 Thread Rob Anderson

Anthony J Segelhorst [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Does anyone already have a perl script that checks to see if a file exists
 or not a Windows Platform?


if (-e $filename) {print There it is\n}


 Anthony J Segelhorst
 Enterprise Systems Management Team
 Phone: 937-495-1876
 Email: [EMAIL PROTECTED]

 
 This email has been scanned for all viruses by the MessageLabs SkyScan
 service.___

 Note:  Please update your email address for this user to reflect the
 new MeadWestvaco Corporation.  MeadWestvaco employee email addresses
 are in the format of [EMAIL PROTECTED]

 This electronic message contains information from MeadWestvaco
 Corporation or subsidiary companies, which may be confidential,
 privileged or otherwise protected from disclosure.  The
 information is intended to be used solely by the recipient(s)
 named.  If you are not an intended recipient, be aware that
 any review, disclosure, copying, distribution or use of this
 transmission or its contents is prohibited.  If you have
 received this transmission in error, please notify MeadWestvaco
 immediately at [EMAIL PROTECTED]
 ___



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



Re: please help !! pattern match

2003-09-05 Thread Rob Anderson

Pandey Rajeev-A19514 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi ,

Hello


 I need some help me to extract a pattern. The delimiters is a pair of
abcd and efgh. Can some one help me with an efficient use of Greedy and
non greedy matches, look ahead and lookbehind features.

 I want the smallest match involving the two delimiters. I want all the
matches. i.e. fisrt match , last match and all ther other matches in
between.


Why do this with a regex? Just because it's written in perl doesn't mean you
_have_ to program in regexes.

How about the following solution, finding the delimiters and printing all
the combos?

#/perl -w


my $string =  abcd 1 edfg 2 abcd edfg 3 4 5 abcd 6 7 edfg 8 9;
my $start_delim = 'abcd';
my $end_delim = 'edfg';
my @start_indices;
my @end_indices;
my $current_index = 0;
while ( ($current_index = index($string, $start_delim, $current_index + 1))
ne -1) { push @start_indices , $current_index};
$current_index = 0;
while ( ($current_index = index($string, $end_delim, $current_index + 1))
ne -1) { push @end_indices , $current_index};

foreach my $start (@start_indices) {
 foreach my $end (@end_indices) {
  next if ($start  $end);

  print $start, $end\n;
 }
}







 Here is what I tried to extract the first match and the results(a bad one)
I got.

 $abc = END;
 aa
 abcd a
 abcd b
 AAA
 BBB
 efgh c
 CCC
 efgh d
 DDD
 EEE
 FFF
 abcd e
 abcd f
 GGG
 HHH
 III
 efgh g
 efgh h
 JJJ
 KKK
 END

 $match = 'abcd(?:(?!abcd).)*efgh.*?\n';
 ($found) = ($abc =~ /($match)(?!$match)/sxi);
 print *\nFOUND FIRST MATCH\n$found\n;

 The OUTPUT IS :
 *
 FOUND FIRST MATCH
 abcd b
 AAA
 BBB
 efgh c
 CCC
 efgh d


 WHEREAS I wanted it to be
 *
 FOUND FIRST MATCH
 abcd b
 AAA
 BBB
 efgh c


 Any suggestion is welcome.

 Thanks in advance.
 Rajeev





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



Modifying a file in place perl -i

2003-09-05 Thread Raj (Basavaraj) Karadakal
Hi,
I am trying to modify some file sin place usinh the -i switch of
perl. In each of the files however I need to replace certain strings with
file name it self.

When I try the following command
perl -i.orig -pe 's/NAME/$0/' `ls -1`

Will replace 'NAME' with '-e' in all the files

How can I get the file names in my script?

Thanks
Basavaraj

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



Re: Modifying a file in place perl -i

2003-09-05 Thread Paul Johnson

Raj (Basavaraj) Karadakal said:
 Hi,
   I am trying to modify some file sin place usinh the -i switch of
 perl. In each of the files however I need to replace certain strings with
 file name it self.

 When I try the following command
 perl -i.orig -pe 's/NAME/$0/' `ls -1`

 Will replace 'NAME' with '-e' in all the files

 How can I get the file names in my script?

$ARGV

perldoc perlvar

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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



Re: split large array into chunks

2003-09-05 Thread Randal L. Schwartz
 Ramprasad == Ramprasad A Padmanabhan [EMAIL PROTECTED] writes:

Ramprasad Hello all,
Ramprasad   Suppose I have a huge array of filenames and I want to move them
Ramprasad I would like to  move 1 chunk at a time on 'n' elements

Ramprasad How Can I efficiently do it ?

Ramprasad something like

Ramprasad @allfiles  = ()   # 1 files

My pattern for that is:

my @copy = @allfiles; # destructive... so we have to copy

while (@copy) {
  my @chunk = splice @copy, 0, 100; # remove first 100 elements (or less)
  ... do something with @chunk ...
}

Seems to work quite easily.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Find the name of all the function on the system

2003-09-05 Thread Randal L. Schwartz
 Marcos == Marcos Rebelo [EMAIL PROTECTED] writes:

Marcos I need to do some kind of generic log trow my code, this will
Marcos be used just in debug mode.

First, you might just consider running your code under the debugger.
You can make a custom debugger hook that traces exactly what you want,
and gets called at every statement boundary, including subroutine
entry/exit.

Second, you might consider Hook::LexWrap (in the CPAN) to perform this
wrapping more programatically.  It's very fast, and created by the Mad
Ozzie Scientist, so it's bound to have some cool applicability.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Modifying a file in place perl -i

2003-09-05 Thread Randal L. Schwartz
 Raj == Raj Karadakal [EMAIL PROTECTED] writes:

Raj Hi,
RajI am trying to modify some file sin place usinh the -i switch of
Raj perl. In each of the files however I need to replace certain strings with
Raj file name it self.

Raj When I try the following command
Raj perl -i.orig -pe 's/NAME/$0/' `ls -1`

Raj Will replace 'NAME' with '-e' in all the files

Raj How can I get the file names in my script?

From 'perldoc perlrun':

From the shell, saying

$ perl -p -i.orig -e s/foo/bar/; ... 

is the same as using the program:

#!/usr/bin/perl -pi.orig
s/foo/bar/;

which is equivalent to

#!/usr/bin/perl
$extension = '.orig';
LINE: while () {
if ($ARGV ne $oldargv) {
if ($extension !~ /\*/) {
$backup = $ARGV . $extension;
}
else {
($backup = $extension) =~ s/\*/$ARGV/g;
}
rename($ARGV, $backup);
open(ARGVOUT, $ARGV);
select(ARGVOUT);
$oldargv = $ARGV;
}
s/foo/bar/;
}
continue {
print;  # this prints to original filename
}
select(STDOUT);

except that the -i form doesn't need to compare $ARGV
to $oldargv to know when the filename has changed.
It does, however, use ARGVOUT for the selected file-
handle.  Note that STDOUT is restored as the default
output filehandle after the loop.

Note the $ARGV there.  Yes, the filename is in $ARGV.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: perl questions / exercices

2003-09-05 Thread Randal L. Schwartz
 Shishir == Shishir Saxena [EMAIL PROTECTED] writes:

Shishir I want to make a cross-platform utility that when provided
Shishir with the location of a directory structure generates the
Shishir following log,

Shishir 1) Date of creation

Not possible in Unix.


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: cutting a string

2003-09-05 Thread denis
On Thu, 4 Sep 2003 [EMAIL PROTECTED] wrote:

 basename is more convenient i think. What do you say?
 
Only if you can load the module on the system. running into issues here at 
work where I can load modules (security llama's)

Denis

 
 Quoting [EMAIL PROTECTED]:
 
  On Mon, 1 Sep 2003 [EMAIL PROTECTED] wrote:
  
   What is the function of cutting a string from a point until the last
  character?
   
   For example
   $string=C:/progra~1/directory1/directory2/file.txt;
   
   i want to find the last backslash (/) of the string and keep the sequence 
   following it (file.txt)
   
   Is it simple? 
   
   I tried with the split function but it returns a list.
   
   I just want a scalar!
   
   
   
   
  
  why not try this?
  
  #!/usr/bin/perl
  my @test='';
  my $test1='';
  my $string = C:/test/me;
  @test = split('/',$string);
  print @test\n;
  print $test[$#test]\n;
  
  HTH.. Denis
  
  
  -- 
  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: split large array into chunks

2003-09-05 Thread John W. Krahn
Ramprasad A Padmanabhan wrote:
 
 Hello all,

Hello,

   Suppose I have a huge array of filenames and I want to move them
 I would like to  move 1 chunk at a time on 'n' elements
 
 How Can I efficiently do it ?
 
 something like
 
 @allfiles  = ()   # 1 files
 @smallchunks = split_to_chunks(@allfiles,100);
   #  This function is what I want to write
 
 foreach (@smallchunks) {
  my $filelist = join( ,@{$_});
 
 .
 }

my @allfiles = ()   # 1 files

while ( my @smallchunks = splice @allfiles, 0, 100 ) {
my $filelist = @smallchunks;
}


John
-- 
use Perl;
program
fulfillment

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



Re: cutting a string

2003-09-05 Thread denis
Sorry, lack of sleep.. but isn't File::Basename usally installed in the 
standard Perl install?

Denis

On Fri, 5 Sep 2003 [EMAIL PROTECTED] wrote:

 On Thu, 4 Sep 2003 [EMAIL PROTECTED] wrote:
 
  basename is more convenient i think. What do you say?
  
 Only if you can load the module on the system. running into issues here at 
 work where I can load modules (security llama's)
 
 Denis
 
  
  Quoting [EMAIL PROTECTED]:
  
   On Mon, 1 Sep 2003 [EMAIL PROTECTED] wrote:
   
What is the function of cutting a string from a point until the last
   character?

For example
$string=C:/progra~1/directory1/directory2/file.txt;

i want to find the last backslash (/) of the string and keep the sequence 
following it (file.txt)

Is it simple? 

I tried with the split function but it returns a list.

I just want a scalar!




   
   why not try this?
   
   #!/usr/bin/perl
   my @test='';
   my $test1='';
   my $string = C:/test/me;
   @test = split('/',$string);
   print @test\n;
   print $test[$#test]\n;
   
   HTH.. Denis
   
   
   -- 
   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: cutting a string

2003-09-05 Thread John
Then we have to install it. However, in activestate's distribution there is
the specific modul preinstalled.


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Perl Beginners [EMAIL PROTECTED]
Sent: Friday, September 05, 2003 7:33 PM
Subject: Re: cutting a string


 Sorry, lack of sleep.. but isn't File::Basename usally installed in the
 standard Perl install?

 Denis

 On Fri, 5 Sep 2003 [EMAIL PROTECTED] wrote:

  On Thu, 4 Sep 2003 [EMAIL PROTECTED] wrote:
 
   basename is more convenient i think. What do you say?
  
  Only if you can load the module on the system. running into issues here
at
  work where I can load modules (security llama's)
 
  Denis
 
  
   Quoting [EMAIL PROTECTED]:
  
On Mon, 1 Sep 2003 [EMAIL PROTECTED] wrote:
   
 What is the function of cutting a string from a point until the
last
character?

 For example
 $string=C:/progra~1/directory1/directory2/file.txt;

 i want to find the last backslash (/) of the string and keep the
sequence
 following it (file.txt)

 Is it simple?

 I tried with the split function but it returns a list.

 I just want a scalar!




   
why not try this?
   
#!/usr/bin/perl
my @test='';
my $test1='';
my $string = C:/test/me;
@test = split('/',$string);
print @test\n;
print $test[$#test]\n;
   
HTH.. Denis
   
   
--
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: case conversion problem

2003-09-05 Thread JOHN FISHER
I am trying to figure out how clever it actually is.
I reversed \L\u with \u\L expecting different results and got the same result.
Another Company Name Ltd

Why didn't reversing the metacharacters change the results.

the \L escape forces lowercase
When written in lowercase (\l and \u), they affect only the next character: 

$pt=~s/(\w+)/\u\L$1/g

$pt=~s/(\w+)/\L\u$1/g


 \L\u  --  isn't perl clever?



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



Bivariate Normal CDF

2003-09-05 Thread Samantha Cook
Hi,

Does anyone have code, or are there modules out there, for calculating 
probabilities for the bivariate normal distribution?

thanks,

sam cook




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



telnet and then run any one command on windows

2003-09-05 Thread Nitin Aggarwal
Hi ,
case 1:
my $hostname = '10.10.2.45';
my $prompt1 = '/\$/';
my $name = 'administrator';
my $password = 'nn';
my $string = 'net start ';
my $session1 = Net::Telnet-new(Host = $hostname,) ;   $session1-login(Name = 
$name, Password = $password, Prompt = $prompt1,);
my @output = $session1-cmd(String = $string, Prompt = $prompt1,);
print  Command output: @output\n; # resultant output is stored line by line in 
@output array. 
case 2:
my @before = $session1-waitfor('/successfully/');
print before: @before\n;
$session1-close; 


I am really new to perl. I am  writing this code to telnet into windows machine and 
run dir/or any one command. If someone can help or give any ideas.
The code works fine on the unix machine and runs the command 'ps -ef'. The code below 
has problem to recognize the C:\ prompt and gives time-out error. I have tried 
different combinations of the Regexp for the dos prompt but nothing seems to work. At 
certain expression it compiles but doesn't print.  
I tried the other way of using the wait for method (case2:)and use buffer. In that 
it is able to print what is in the buffer but not the exact output of the command. 
Say if you want to telnet to DOS machine and print the command 'dir' on that machine 
and see the output on your machine.
Would appreciate if someone can help. 

thanks
Nitin

RE: Bivariate Normal CDF

2003-09-05 Thread wiggins


On Fri, 5 Sep 2003 14:47:31 -0400 (EDT), Samantha Cook [EMAIL PROTECTED] wrote:

 Hi,
 
 Does anyone have code, or are there modules out there, for calculating 
 probabilities for the bivariate normal distribution?
 

Well a very quick look, and what I would consider a *very* basic understanding of 
statistics and what you are asking you should check out the following links to see if 
they give you any help:

http://search.cpan.org/modlist/Data_and_Data_Types
Specifically the Statistics:: modules

and if nothing in there helps much you might be able to grow your own using some of 
the Math:: modules:

http://search.cpan.org/modlist/Data_and_Data_Types/Math

Good luck,

http://danconia.org

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



Do not understand Hashes !

2003-09-05 Thread Larry Sandwick
I have a problem with hashes and trying to understand them, I have read
the perldoc intersection and looked into the Perl Cookbook, and still do
not understand how I should handle this problem. 

 

I have a master file with part number and quantity in it. I also have a
file that has the same information in it, part number and quantity. Both
files are comma, delimited.

 

What I am trying to do is read in the Master file, and then read in the
second file. Compare the second file to the Master file and decrement
the quantity in  Master file. Then print out the results 

 

Example Master file:

1011-303,  3

1021-329,  2

1021-333,  1

1021-336,  1

1021-340,  2

1021-323,  1

1021-330,  1

1021-334,  1

1021-341,  2

 

Example Data file

1011-303,  2

1021-329,  2

1021-333,  1

1021-336,  2

1021-340,  1

1021-323,  1

1021-330,  1

1021-334,  1

1021-341,  1

2044-666,  1

 

 

 

Code follows .. You will see that I am missing the code in the foreach .
if that is what I need to use

snip

 

$fname = $ARGV[0] || scanned.file;

 

open(Master, master.file) || die (Could not open file $!);

 

my %master_file = Master;

close(Master);

 

open(DATA, $fname ) || die (Could not open file $!);

my $count=0;

 

# open my hash

foreach $item ( $fname )

{

  #

  # subratract the information in HasH % master_file

  # 

}

 

# print results

open(NewMasterList,Results.file) || die (Could not write file $!);

 

close (DATA);

close (NewMasterList);

exit;

 

Any help would be greatly appreciated !!!

 

TIA

 

Larry Sandwick

Sarreid, Ltd.

Network/System Administrator

phone: (252) 291-1414 x223

fax  : (252) 237-1592

 



re: case conversion problem

2003-09-05 Thread david
John Fisher wrote:

 I am trying to figure out how clever it actually is.
 I reversed \L\u with \u\L expecting different results and got the same
 result. Another Company Name Ltd
 
 Why didn't reversing the metacharacters change the results.
 

[snip]

 
 $pt=~s/(\w+)/\u\L$1/g
 
 $pt=~s/(\w+)/\L\u$1/g
 

because \L\u and \u\L is exactly the same:

[panda]$ perl -MO=Deparse -e 's/(\w+)/\L\u$1/g; s/(\w+)/\u\L$1/g'
s/(\w+)/\u\L$1\E/g;
s/(\w+)/\u\L$1\E/g;
-e syntax OK
[panda]$


david
-
$_=q?015001450154015401570040016701570162015401440041?,local$,split$`;**=*_,
map{$#.=qq~chr(@_[$_1..$*1|3]),~}grep{~$_1}0..s~.~~g-1;*_=*#,print+eval,

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



Re: Do not understand Hashes !

2003-09-05 Thread Matt Matijevich
I am only a Perl beginner myself (there is probably much better ways to
do this) but I put this together, I did not use the $ARGV array but that
should be easy to change, I also manually deleted blank lines and spaces
from the input files so you might want to check for those when you are
looping through your arrays:

open(Master, master.txt) || die (Could not open file $!);
open(DATA, data.txt ) || die (Could not open file $!);


my (@temp,%master);

my @master_file = Master;
my @data_file = DATA;

close(Master);
close (DATA);

 
foreach (@master_file) {
chomp($_);
@temp = split(',', $_);
$master{$temp[0]} = $temp[1];
}


foreach (@data_file) {
chomp($_);
@temp = split(',', $_);
$master{$temp[0]} -= $temp[1];
}




open(NewMasterList,Results.txt) || die (Could not write file
$!);
foreach (keys %master) {
print NewMasterList $_,$master{$_}\n;

}
 



close (NewMasterList);

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



Re: Do not understand Hashes !

2003-09-05 Thread James Edward Gray II
On Friday, September 5, 2003, at 02:07  PM, Larry Sandwick wrote:

I have a problem with hashes and trying to understand them, I have read
the perldoc intersection and looked into the Perl Cookbook, and still 
do
not understand how I should handle this problem.

I have a master file with part number and quantity in it. I also have a
file that has the same information in it, part number and quantity. 
Both
files are comma, delimited.

What I am trying to do is read in the Master file, and then read in the
second file. Compare the second file to the Master file and decrement
the quantity in  Master file. Then print out the results
How about something like this (untested code):

#!/usr/bin/perl

use strict;
use warnings;
my %quantities;

# load the hash from the master file
open MASTER, path/to/masterfile.txt or die File error:  $!\n;
while (MASTER) {
my($code, $amount) = split /,/, $_;
$quantities{$code} = $amount;
}
close MASTER;
# modify the entries
open CHANGES, path/to/changes.txt or die File error:  $!\n;
while (CHANGES) {
my($code, $amount) = split /,/, $_;
$quantities{$code} -= $amount if exists $quantities{$code};
}
close CHANGES;
# out the results
print $_, $quantities{$_}\n foreach keys %qauntities;
__END__

James

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


Re: Do not understand Hashes !

2003-09-05 Thread John W. Krahn
Larry Sandwick wrote:
 
 I have a problem with hashes and trying to understand them, I have read
 the perldoc intersection and looked into the Perl Cookbook, and still do
 not understand how I should handle this problem.

perldoc perldata


 I have a master file with part number and quantity in it. I also have a
 file that has the same information in it, part number and quantity. Both
 files are comma, delimited.
 
 What I am trying to do is read in the Master file, and then read in the
 second file. Compare the second file to the Master file and decrement
 the quantity in  Master file. Then print out the results
 
 Example Master file:
 1011-303,  3
 1021-329,  2
 1021-333,  1
 1021-336,  1
 1021-340,  2
 1021-323,  1
 1021-330,  1
 1021-334,  1
 1021-341,  2
 
 Example Data file
 1011-303,  2
 1021-329,  2
 1021-333,  1
 1021-336,  2
 1021-340,  1
 1021-323,  1
 1021-330,  1
 1021-334,  1
 1021-341,  1
 2044-666,  1
 
 Code follows .. You will see that I am missing the code in the foreach .
 if that is what I need to use
 snip
 
 $fname = $ARGV[0] || scanned.file;
 
 open(Master, master.file) || die (Could not open file $!);
 
 my %master_file = Master;
 close(Master);
 
 open(DATA, $fname ) || die (Could not open file $!);
 my $count=0;
 
 # open my hash
 foreach $item ( $fname )
 {
   #
   # subratract the information in HasH % master_file
   #
 }
 
 # print results
 open(NewMasterList,Results.file) || die (Could not write file $!);
 
 close (DATA);
 close (NewMasterList);
 exit;
 
 Any help would be greatly appreciated !!!


I would read the data file first and then modify the master file:

my $fname = shift || 'scanned.file';

open DATA, $fname or die Could not open $fname: $!;
my %data = map /^([^,]+),\s*(\d+)/, DATA
close DATA;

open Master, 'master.file' or die Could not open master.file: $!;
open NewMasterList, 'Results.file' or die Could not write
Results.file: $!;

while ( Master ) {
# assumes that you want to preserve the spacing
my ( $key, $space, $val ) = /^([^,]+),(\s*)(\d+)/;
if ( exists $data{ $key } ) {
$_ = $key,$space . $val - $data{ $key } . \n;
}
# print results
print NewMasterList;
}

close Master;
close NewMasterList;
exit 0;

__END__


John
-- 
use Perl;
program
fulfillment

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



Re: Do not understand Hashes !

2003-09-05 Thread John W. Krahn
John W. Krahn wrote:
 
 I would read the data file first and then modify the master file:
 
 my $fname = shift || 'scanned.file';
 
 open DATA, $fname or die Could not open $fname: $!;
 my %data = map /^([^,]+),\s*(\d+)/, DATA

Should be a semicolon at the end.

my %data = map /^([^,]+),\s*(\d+)/, DATA;


 close DATA;
 
 open Master, 'master.file' or die Could not open master.file: $!;
 open NewMasterList, 'Results.file' or die Could not write
 Results.file: $!;
 
 while ( Master ) {
 # assumes that you want to preserve the spacing
 my ( $key, $space, $val ) = /^([^,]+),(\s*)(\d+)/;
 if ( exists $data{ $key } ) {
 $_ = $key,$space . $val - $data{ $key } . \n;
 }
 # print results
 print NewMasterList;
 }
 
 close Master;
 close NewMasterList;
 exit 0;
 
 __END__


John
-- 
use Perl;
program
fulfillment

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



Does anyone gets duplicated copies of a message all the time?!

2003-09-05 Thread Wong, Nelson
Hi all,

 

I always get three identical copies of a message all the time,
therefore, I just wonder if anyone has the same situation as mine!

 

Thanks! 

BTW, it is a great ML!!! Happy knowledge sharing!

 

Nelson



Re: case conversion problem

2003-09-05 Thread Paul Johnson
On Fri, Sep 05, 2003 at 12:29:31PM -0700, david wrote:

 John Fisher wrote:
 
  I am trying to figure out how clever it actually is.
  I reversed \L\u with \u\L expecting different results and got the same
  result. Another Company Name Ltd
  
  Why didn't reversing the metacharacters change the results.

Because \L\u doesn't make any sense, so perl does what you (and Jenda)
probably meant.  If that wasn't what you meant, get rid of the redundant
\u.

  $pt=~s/(\w+)/\u\L$1/g
  
  $pt=~s/(\w+)/\L\u$1/g
  
 
 because \L\u and \u\L is exactly the same:
 
 [panda]$ perl -MO=Deparse -e 's/(\w+)/\L\u$1/g; s/(\w+)/\u\L$1/g'
 s/(\w+)/\u\L$1\E/g;
 s/(\w+)/\u\L$1\E/g;
 -e syntax OK
 [panda]$

Because of this little bit of magic in toke.c:

if (strnEQ(s, L\\u, 3) || strnEQ(s, U\\l, 3))
tmp = *s, *s = s[2], s[2] = (char)tmp;  /* misordered... */

What other language is so helpful?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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



Re: REPOST - print c:\program files\*.*;

2003-09-05 Thread Robert Citek

Hello Edward,

At 05:07 PM 9/5/2003 +0800, Edward Yang wrote:
The problem is I do not get correct result from the following code:
print c:\program files\*.*;
or
print c:\\program files\\*.*;

I don't use perl in Windows, but I can simulate a similar result on Linux
or Mac OS X:
  mkdir foo bar
  cd foo bar
  touch a b c
  cd ..
  perl -le 'print join(\n, foo bar/*);

I can get things to work by adding in two back slashes befor the space in
the name:
  perl -le 'print join(\n, foo\\ bar/*);

Perhaps this will work with Windows as well.

Regards,
- Robert


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



RE: REPOST - print c:\program files\*.*;

2003-09-05 Thread Hanson, Rob
Windows is a little weird here because of the way long filenames are
supported.  You need to use the short name of the directory, which is the
first 6 letters - a tilda - and a number (always 1, unless there multiple
files with the same first 6 chars).

This works for me:
print c:/progra~1/*.*;

Rob

-Original Message-
From: Robert Citek [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 8:24 PM
To: [EMAIL PROTECTED]
Subject: Re: REPOST - print c:\program files\*.*;



Hello Edward,

At 05:07 PM 9/5/2003 +0800, Edward Yang wrote:
The problem is I do not get correct result from the following code:
print c:\program files\*.*;
or
print c:\\program files\\*.*;

I don't use perl in Windows, but I can simulate a similar result on Linux
or Mac OS X:
  mkdir foo bar
  cd foo bar
  touch a b c
  cd ..
  perl -le 'print join(\n, foo bar/*);

I can get things to work by adding in two back slashes befor the space in
the name:
  perl -le 'print join(\n, foo\\ bar/*);

Perhaps this will work with Windows as well.

Regards,
- Robert


-- 
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: REPOST - print c:\program files\*.*;

2003-09-05 Thread Hanson, Rob
This also works and is more portable...

my $dir = 'C:/Program Files';
opendir DIR, $dir;
print map {$dir/$_} grep {/.+\..+/} readdir(DIR);
closedir DIR;

Rob


-Original Message-
From: Hanson, Rob 
Sent: Friday, September 05, 2003 8:38 PM
To: [EMAIL PROTECTED]
Subject: RE: REPOST - print c:\program files\*.*;


Windows is a little weird here because of the way long filenames are
supported.  You need to use the short name of the directory, which is the
first 6 letters - a tilda - and a number (always 1, unless there multiple
files with the same first 6 chars).

This works for me:
print c:/progra~1/*.*;

Rob

-Original Message-
From: Robert Citek [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 8:24 PM
To: [EMAIL PROTECTED]
Subject: Re: REPOST - print c:\program files\*.*;



Hello Edward,

At 05:07 PM 9/5/2003 +0800, Edward Yang wrote:
The problem is I do not get correct result from the following code:
print c:\program files\*.*;
or
print c:\\program files\\*.*;

I don't use perl in Windows, but I can simulate a similar result on Linux
or Mac OS X:
  mkdir foo bar
  cd foo bar
  touch a b c
  cd ..
  perl -le 'print join(\n, foo bar/*);

I can get things to work by adding in two back slashes befor the space in
the name:
  perl -le 'print join(\n, foo\\ bar/*);

Perhaps this will work with Windows as well.

Regards,
- Robert


-- 
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: REPOST - print c:\program files\*.*;

2003-09-05 Thread Bob Showalter
Edward Yang wrote:
 I'm not sure if this is a bug.

 I'm running Perl 5.8 on a Windows 2000 Pro system (with SP4 and all
 latest hotfixes installed).

 Running perl -v  I get:
 This is perl, v5.8.0 built for MSWin32-x86-multi-thread

 ~~

 The problem is I do not get correct result from the following code:
 print c:\program files\*.*;
 or
 print c:\\program files\\*.*;

 I get only one line of output text:
 c:./program

 I'm a beginner on Perl, though I've written several scripts
 manipulating Web sites and managing downloads. I wonder if it is a
 bug on Windows system or I'm doing something wrong.

The problem is that the underlying glob() function splits the argument on
whitespace. I was able to get the following working:

   use File::Glob ':glob';
   print bsd_glob('C:\Program Files\*');

See perldoc File::Glob for more details.

This also works, but is not exactly equivalent:

   print C:\\Program?Files\\*;

It replaces the space with a ? wildcard character so there's no whitespace.

This also appears to work, but I'm not sure why. Discovered by trial and
error:

   print C:/Program\\\ Files/*;



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



Re: passing an argument to a subroutine

2003-09-05 Thread Todd W.

B. Fongo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello

 An argument passed to a subroutine returns wrong value.

 Code example:

 @x = (1..5);
 $x = @x;


here, $x gets the number of elements in @x


 showValue ($x);   # or showValue (\$x);


 sub showValue {

   my $forwarded = @_;


$forwarded gets the number of elements in @_


   print $forwarded;  # print ${$forwarded};

 }

 In both cases, the script prints out 1.
 What is going on here?


What do you expect to happen? What _is_ happening is exactly what is
supposed to.

Todd W.



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