thx for your help

2001-11-03 Thread Petazzoni Maxime aka sam

hi every one
i'm found the solution for my threads. i've replaced threads by the
select function, unsing vectors as described in the perlfunc manpage.
i obtain sthing like that (see attachement)

thx for your help
sam
-- 
...
| sam  °)(° mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..__\_/\_/.
 client.pl

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


Without modifications

2001-11-03 Thread pc

I need to learn how to program CGI applications on a Unix box. However, I
would rather not do testing on our production internet server. We don't have
another unix box I can work on. Is it possible to test CGI applications in
the Windows environment? If so, will they run without modification in the
unix environment?

Pc


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




Perl with Java

2001-11-03 Thread pc

How widely is Perl Used in Java Shops?

Pc

_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




Re: Silly problem

2001-11-03 Thread Michael D. Risser

While that would work, since it is only a one line text file containing a 
single I.P. address a much simpler way would be:

#!/usr/bin/perl -w

open(IPFILE, ipaddress);
chomp(my $ipaddress = IPFILE);

The regex is, in this case at least, not really necessary.

Note the the key here is the chomp() function which removes any newline 
characters in the string that gets passed to it.

On Friday 02 November 2001 09:06 pm, Wagner-David wrote:
 Uncertain what you are attempting to do, but:

 #!perl -w
 while ( DATA ) {
chomp;
if ( /^(\d+\.\d+.\d+\.\d+)/ ) { #Extact the IP address here and stote as
 $1 print $1\n;
 }
  }
 __DATA__
 192.168.0.2
 This should not print

 199.88.22.111
 ^ Script ends here
 Output:
 192.168.0.2
 199.88.22.111


 Wags ;)

 -Original Message-
 From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 16:19
 To: [EMAIL PROTECTED]
 Subject: Silly problem


 G'day All,

 I have this very very simple problem that I can't figure out.  Basically
 I have a 1 line text file with an IP address in it like so...

 192.168.0.2

 Now all I want to do is open this file up and extract the IP address
 from it.  Now the good thing is I can do this OK but whenever I extract
 it it seems to be appending a new line on the end of it.  Can some one
 help me and give me some ideas on what I am doing wrong?  My code so far
 looks like this...

 open (FH, $file); #...and open the textfile for reading
 @line=FH; #Store ppp0 as an array
 $line =~ /^(\d+\.\d+.\d+\.\d+)/; #Extact the IP address here and stote
 as $1
 print @test;
 close(FH);

 printing @test works fine but it appends a new line.  The code also
 won't assign $1 to the IP address?

 Is it something simple I am doing wrong?

 Regards,

 Dan

 ==
 VINTEK CONSULTING PTY LTD
 (ACN 088 825 209)
 Email:  [EMAIL PROTECTED]
 WWW:http://www.vintek.net
 Tel:(08) 8523 5035
 Fax:(08) 8523 2104
 Snail:  P.O. Box 312
 Gawler   SA   5118
 ==

-- 
Michael D. Risser
Software Engineer/Linux Administrator
=
Machine Vision Products, Inc.
www.visionpro.com
[EMAIL PROTECTED]
-BEGIN PGP PUBLIC KEY BLOCK-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

mQGiBDuCrxARBADE9hdFrBY4oQG8dnGZo6HV1pPXdiS1yVhDA1Hp0nTcmhsAdBtu
udBPkwwrVKATJYWQsRYBwbjE9WhyeGKXW95BkeUfDQo6YJBGBaeZSnfJhugdnoEv
+UB3c7McRenM6dN0oeDBWhcylTMpdUEbM9BG3pHUrKIh/TECDESWsS2PRwCgkGMy
HTSPVa3xzwAyt4C5FPINSkcEALHAysCwpYou3n1BOjjIR/lc2Wg9jMDxCL5Kf5qh
JIfvPu5Ew/NjkcTtoUrF8Ag4++3/D9jaHpFiUvp5xKtd/CjI+zQmWYvan3Qa5D6D
ZXNAvQzDpHMQ0PNed4lD6+a2unfMI22yh57WZ51nKajSGi3kbRd+564ZdM3BC3tU
30eaA/9uwrGaTCKUpku9Q7xOXRUTQOzPKMuUkGrHK84Fea8BhRYm3P/im6+mgKPu
OeAZuxTX3KD8WyTz3wPc3C9RVkcOeii90r8AbztYFa3jq7ryAxXuIAJClDyvmVxz
0i0/QsUG7Qmh3bSqSEE8j0wS1d+oCK0vys/kzPQu4BlSIZYlArQ9TWljaGFlbCBE
LiBSaXNzZXIgKFNvZnR3YXJlIEVuZ2luZWVyKSA8bWljaGFlbEB2aXNpb25wcm8u
Y29tPohXBBMRAgAXBQI7gq8QBQsHCgMEAxUDAgMWAgECF4AACgkQ/ikO9QMSg3cj
CwCfUw/OvLdfH3J6wDkgJkgwIZdJgmgAn1PAfxKjgiFXcteIpUtN6s988k1CuQEN
BDuCrxIQBADw8yDbbWdO9pvyUpdWjWxTBBFo9eQexJFFap4b9KcpWDJWawZ6S/HU
Cn+7zfbFb43AZa21mlon/vr7nwvlll7P/fa9S4kvk5twM8PcwM9O9yVxhOZeInXR
NUBzqjpK8FfRZgt1TaOz/CpdacNAJ9i2cShvH6wcCbHxGL9rjAu+IwADBgQA0t8p
1ivBcABEmK4o+r5+uXZoQ4jUzDDN5bZmddQOQhyyMX/JUeBX7gxQ7r2cYJHIlcN+
FCeqUHLmgQ/Ky+gze61Yr+FeEBJ4EPklkHWu3RoS4aKlEtU688nm+8Mfph6nYl+n
HzmaZjf5hz/mqvs5bzBCrw+xSSjNhJBrmj8qzIqIRgQYEQIABgUCO4KvEgAKCRD+
KQ71AxKDd2/JAJ9vnTOSbmB2XceA4gBaOsZg06s5lQCfYfRtXoy/Mbw82eS19NE/
w9t+V8g=
=J9H/
-END PGP PUBLIC KEY BLOCK-

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




array slice syntax

2001-11-03 Thread Thomas Hofer

Hi!

As a perl beginner, I have a silly question about 
array-slices-syntax:

That's clear:

perl -e '@a=(a,b,c);print @a[1..2]\n'
== b c

perl -e '@a=(a,b,c);print $a[1]\n'
== b

But why does $array[range] always give the first array-entry?

perl -e '@a=(a,b,c);print $a[1..2]\n'
== a

(OK, maybe it's useless, but I'd like to understand...)

Thomas.


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




merging two hashes together?

2001-11-03 Thread AMORE,JUAN (HP-Roseville,ex1)

Hello Perl Gurus,
I'm trying to write a program that will merge two hashes together onto a
third hash called %h3. I need to
return a reference to %h3 to the main program and print each of the values
of the hash %h3 using the arrow notation. 
Name of the actual function performing the merge mergehash.  Pass %h1 and
%h2 to mergehash as references.
The function call in the main program will be something like the following
where $ref_h3 will be used to print the values in %h3. 

$ref_h3 = mergehash(_, _);

%h1 = (one = 1, two = 2, three = 3);
%h2 = (four = 4, five = 5, six = 6);



Many Thanks!!!:)
JA





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




HOw do I create a package:

2001-11-03 Thread AMORE,JUAN (HP-Roseville,ex1)

Hello,
CAn anyone show me how to create a package called StringPrint and place this
package in a filename called StringPrint.pm using a subroutine, called
print_str, that prints a string passed to the subroutine defined by the
module.

Many Thanks!
JA

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




Re: HOw do I create a package:

2001-11-03 Thread Jos I. Boumans

you're talking about simple OO programming...
i wrote a tutorial on just that subject, i think it will help you along with
your project.

take a look here:
http://japh.nu/index.cgi?base=tuts

hth,
Jos

- Original Message -
From: AMORE,JUAN (HP-Roseville,ex1) [EMAIL PROTECTED]
To: Beginners@Perl. Org (E-mail) [EMAIL PROTECTED]
Sent: Saturday, November 03, 2001 7:18 PM
Subject: HOw do I create a package:


 Hello,
 CAn anyone show me how to create a package called StringPrint and place
this
 package in a filename called StringPrint.pm using a subroutine, called
 print_str, that prints a string passed to the subroutine defined by the
 module.

 Many Thanks!
 JA

 --
 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: merging two hashes together?

2001-11-03 Thread Wagner-David

Here is one shot, though I changed some of the constants:

#!perl -w

my %h1  = (one = 1, two = 2, three = 3);
my %h2  = (four = 4, five = 5, six = 6);
my %h3  = ();

mergehash( \%h1, \%h2, \%h3);


sub mergehash {
my ( $h1, $h2, $h3) = @_;
foreach my $MyKey1 ( keys %{$h1} ) {
$h3-{$MyKey1} = $h1-{$MyKey1};
 }

foreach my $MyKey2 ( keys %{$h2} ) {
$h3-{$MyKey2} = $h2-{$MyKey2};
 }

foreach my $MyKey (sort keys %{$h3}) {
printf %-9s: %3d\n, $MyKey, $h3-{$MyKey};
 }

 } # end of mergehash

Output:
five :   5
four :   4
one  :   1
six  :   6
three:   3
two  :   2

Wags ;)

-Original Message-
From: AMORE,JUAN (HP-Roseville,ex1) [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 03, 2001 10:09
To: Beginners@Perl. Org (E-mail)
Cc: 'Maxim Berlin'
Subject: merging two hashes together?


Hello Perl Gurus,
I'm trying to write a program that will merge two hashes together onto a
third hash called %h3. I need to
return a reference to %h3 to the main program and print each of the values
of the hash %h3 using the arrow notation. 
Name of the actual function performing the merge mergehash.  Pass %h1 and
%h2 to mergehash as references.
The function call in the main program will be something like the following
where $ref_h3 will be used to print the values in %h3. 

$ref_h3 = mergehash(_, _);

%h1 = (one = 1, two = 2, three = 3);
%h2 = (four = 4, five = 5, six = 6);



Many Thanks!!!:)
JA





-- 
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]




Array with selected records.

2001-11-03 Thread Mark Weisman

Hello all:
  Hey I'm wanting to populate an array with only select records, but I'm
not sure how (more importantly when) to use a comparison piece. Please
help me if you can:

Open (INFILE, something.txt)
Or die Error opening something.txt. $!, stopped;
@records = INFILE
close(INFILE);
foreach my $rec (@records) {
chomp($rec);
($val, $val1, $val2, etc.) = split(/,/, $rec);

This is my opening and building the array from a text file. However what
I want to be able to do, is open the text file, then separate out the
records based on one value (example $val1) and build another text file
based on just the records that match the criteria.

Open (INFILE, something.txt)
Or die Error opening something.txt. $!, stopped;
@records = INFILE
close(INFILE);
foreach my $rec (@records){
open (OUTFILE1, firstchoice.txt)
or die Error opening firstchoice.txt. $!, stopped;
if ($val1 == Bill Smith)
print $rec (OUTFILE);
}
}

I'm loosing my mind here, I just want the records that match the
criteria to be dumped into the OUTFILE. Any and all assistance would be
greatly appreciated.

Thank you,
Mark


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




Re: array slice syntax

2001-11-03 Thread Paul Johnson

On Sat, Nov 03, 2001 at 05:49:37PM +0100, Thomas Hofer wrote:
 Hi!
 
 As a perl beginner, I have a silly question about 
 array-slices-syntax:
 
 That's clear:
 
 perl -e '@a=(a,b,c);print @a[1..2]\n'
 == b c
 
 perl -e '@a=(a,b,c);print $a[1]\n'
 == b
 
 But why does $array[range] always give the first array-entry?
 
 perl -e '@a=(a,b,c);print $a[1..2]\n'
 == a
 
 (OK, maybe it's useless, but I'd like to understand...)

Really?  OK, then :-)

You are using .. in a scalar context.  This is totally different to
using it in an array context.  In scalar context it is the bistable
operator which returns false while its first operand is false, then true
until its second operand is true.  Read more in perlop.

When either operand to .. is a constant, which would otherwise not make
sense, the operand is compared to $. - the number of the line currently
being read.

So, for you the .. operator is returning false, which is converted to 0.

If you want to see what .. is returning, run this:

$ echo 1\n2\n3\n4\n5\n6 | perl -ne 'print , scalar(3..5), \n'


1
2
3E0


These return values are guaranteed.

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

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




Re: Perl with Java

2001-11-03 Thread Greg Meckes

We use Perl and Java in our shop. I'm the Perl guy and I haven't encountered any 
situation where I
couldn't code up something to do same thing that the Java apps do.

That's not to bring into it any 'preference' of one language over the other as they 
both have
their usability goods and bads.

We experience a variety of problems using Java because of it's security lockdown 
coding style -
which is a good thing - but makes for longer dev/debug time. 

It's easy to code things up in Perl and get them to do the same thing.

These issues came be overcome I'm surebut this is what we have been facing.

greg

--- pc [EMAIL PROTECTED] wrote:
 How widely is Perl Used in Java Shops?
 
 Pc
 
 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

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




RE: Array with selected records.

2001-11-03 Thread Wagner-David

In your test you are using numeric == vs eq string comparsion for one thing. 
Also switch the print to:
print OUTFILE1 $rec;

Wags ;)

-Original Message-
From: Mark Weisman [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 03, 2001 11:09
To: 'Beginners@Perl. Org (E-mail)'
Subject: Array with selected records.


Hello all:
  Hey I'm wanting to populate an array with only select records, but I'm
not sure how (more importantly when) to use a comparison piece. Please
help me if you can:

Open (INFILE, something.txt)
Or die Error opening something.txt. $!, stopped;
@records = INFILE
close(INFILE);
foreach my $rec (@records) {
chomp($rec);
($val, $val1, $val2, etc.) = split(/,/, $rec);

This is my opening and building the array from a text file. However what
I want to be able to do, is open the text file, then separate out the
records based on one value (example $val1) and build another text file
based on just the records that match the criteria.

Open (INFILE, something.txt)
Or die Error opening something.txt. $!, stopped;
@records = INFILE
close(INFILE);
foreach my $rec (@records){
open (OUTFILE1, firstchoice.txt)
or die Error opening firstchoice.txt. $!, stopped;
if ($val1 == Bill Smith)
print $rec (OUTFILE);
}
}

I'm loosing my mind here, I just want the records that match the
criteria to be dumped into the OUTFILE. Any and all assistance would be
greatly appreciated.

Thank you,
Mark


-- 
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[2]: merging two hashes together?

2001-11-03 Thread Maxim Berlin

Hello Wagner-David,

Saturday, November 03, 2001, Wagner-David [EMAIL PROTECTED] wrote:

WD Here is one shot, though I changed some of the constants:

WD #!perl -w

my %h1  = (one = 1, two = 2, three = 3);
my %h2  = (four = 4, five = 5, six = 6);
WD my %h3  = ();

WD mergehash( \%h1, \%h2, \%h3);


WD sub mergehash {
WD my ( $h1, $h2, $h3) = @_;
WD foreach my $MyKey1 ( keys %{$h1} ) {
WD $h3-{$MyKey1} = $h1-{$MyKey1};
WD  }

[...]

jfyi (just for your information): think about
%h3=(%h1,%h2);


Best wishes,
 Maximmailto:[EMAIL PROTECTED]


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




regexp question

2001-11-03 Thread Martin Karlsson

Hi all!

Could anyone give me a push in the right direction, please?
How do I write a regexp that matches double instances of letters (in a
file i read into a variable), e.g. aa LL pp etc. ?

Is there an easy way, or must I use
(aa|bb|cc|... and so on ) ?
Thanks for your time!
-- 

Martin Karlsson [EMAIL PROTECTED]

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




Re: regexp question

2001-11-03 Thread Jeff 'japhy' Pinyan

On Nov 3, Martin Karlsson said:

Could anyone give me a push in the right direction, please?
How do I write a regexp that matches double instances of letters (in a
file i read into a variable), e.g. aa LL pp etc. ?

Is there an easy way, or must I use
   (aa|bb|cc|... and so on ) ?

You want to use a backreference:

  if ($string =~ /([a-zA-Z])\1/) {
# $1 is the character that was doubled
  }

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


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




Re: Without modifications

2001-11-03 Thread eventualdeath

Yes you can! use activestate from http://activestate.com/

- Original Message -
From: pc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 03, 2001 8:54 PM
Subject: Without modifications


 I need to learn how to program CGI applications on a Unix box. However, I
 would rather not do testing on our production internet server. We don't
have
 another unix box I can work on. Is it possible to test CGI applications in
 the Windows environment? If so, will they run without modification in the
 unix environment?

 Pc


 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com


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


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




Re: regexp question

2001-11-03 Thread Martin Karlsson

Thanks Jeff! Works like a charm!

Be well!
/Martin
* Jeff 'japhy' Pinyan ([EMAIL PROTECTED]) wrote:
 On Nov 3, Martin Karlsson said:
 
 Could anyone give me a push in the right direction, please?
 How do I write a regexp that matches double instances of letters (in a
 file i read into a variable), e.g. aa LL pp etc. ?
 
 Is there an easy way, or must I use
  (aa|bb|cc|... and so on ) ?
 
 You want to use a backreference:
 
   if ($string =~ /([a-zA-Z])\1/) {
 # $1 is the character that was doubled
   }
 
 -- 
 Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
 RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 ** Look for Regular Expressions in Perl published by Manning, in 2002 **
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 

Martin Karlsson [EMAIL PROTECTED]

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




script for internal site link checks

2001-11-03 Thread birgit kellner

I'm having a cgi script administer a web site, and would now like to add 
the possibility to change html file names via the script. This might also 
involve moving the file to a different directory.
Assuming that other files will link to said file, I'd then have to update 
links as well.
So I'm currently thinking about how internal site links can be updated 
automatically when a file is moved.

Does anyone know of a perl script that does something like that, or of an 
approach I could use?
I could open all files of the site, check whether they contain a link to 
$old_file_name and replace it with $new_file_name, but most links are 
relative, and ... well, before I think further along that path, has anyone 
else?

Thanks in advance,

Birgit Kellner

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




Re: merging two hashes together?

2001-11-03 Thread Dave Storrs


In the example you provide, this will work:

-START
%h1 = (one = 1, two = 2, three = 3);
%h2 = (four = 4, five = 5, six = 6);

#  Note that the '' on function calls is optional, unlike $, @, and %
$ref_h3 = mergehash(_, _);

sub mergehash {
my ($rh_first, $rh_second) = @_;

{ %$rh_first, %$rh_second };  # POINT A
}
-FINISH

The line labelled 'POINT A' does all the work:  it constructs a
new, anonymous hash reference, initializes it, and (since it is the last
value in the function) returns it.  Basically, we dereference the two hash
references back into hashes, unroll them into lists of key/value pairs,
and use them to initialize the new hash we are building.

Note, however, that if %h1 and %h2 share any keys in common will
end up with the value of whichever hash you list LAST in the hashref.
This problem is without solution within the parameters given; no matter
what you do, Perl's builtin hash type cannot have duplicated keys, and no
key may have more than one value.  Now, you can get around it in a LOT of
ways...you can use array references to store your values (meaning that one
key can hold as many values as you want, hidden inside the array ref),
and/or you can use fancy object-oriented magic to make a magical data
structure that pretends to be a hash but can have duplicate keys.

HTH,

Dave

On Sat, 3 Nov 2001, AMORE,JUAN (HP-Roseville,ex1) wrote:

 Hello Perl Gurus,
 I'm trying to write a program that will merge two hashes together onto a
 third hash called %h3. I need to
 return a reference to %h3 to the main program and print each of the values
 of the hash %h3 using the arrow notation.
 Name of the actual function performing the merge mergehash.  Pass %h1 and
 %h2 to mergehash as references.
 The function call in the main program will be something like the following
 where $ref_h3 will be used to print the values in %h3.

   $ref_h3 = mergehash(_, _);

 %h1   = (one = 1, two = 2, three = 3);
 %h2   = (four = 4, five = 5, six = 6);



 Many Thanks!!!:)
 JA







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




Re: HOw do I create a package:

2001-11-03 Thread Dave Storrs


With all due respect, this list is here to help beginner perl programmers
deal with programming problems, not to do people's homework for them.
(The 'hp.com' address (which prominently dispalys an ad for hp's online
university) is a bit of a giveaway.)

Read this:  perldoc perlmod

Dave


On Sat, 3 Nov 2001, AMORE,JUAN (HP-Roseville,ex1) wrote:

 Hello,
 CAn anyone show me how to create a package called StringPrint and place this
 package in a filename called StringPrint.pm using a subroutine, called
 print_str, that prints a string passed to the subroutine defined by the
 module.

 Many Thanks!
 JA



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




Can I use split to split existing array !

2001-11-03 Thread eventualdeath

Hi,

I need some clarification :-

Q1)Can I use the split function to split an existing array (with several elements 
) such as the example below.

Q2)Could it be that the split function can only be used to split a scalar (one 
element).

Q3)Could someone explain to me the reason why @readagain return the number 4, and 
$#readagain return 0.

@read = (hi please, help me, on this , problem);
@readagain = split (/whatever/, @read);

print What happened here, it return 4 =, @readagain,\n;

##



Thanks





Re: Can I use split to split existing array !

2001-11-03 Thread nafiseh saberi

hi...
all of  your problem will solve with split..
it is very powerful...
please see in...

split [ PATTERN [ , EXPR† [ , LIMIT ] ] ]
Splits a string into an array of strings, and returns it. If LIMIT is
specified, splits into at most that number of fields. If PATTERN is also
omitted, splits at the whitespace. If not in array context, returns number
of fields and splits to @_.
and in
http://www.perldoc.com/perl5.6/pod/func/split.html
bye.




  _
  Best regards

  Try to always be hopefull

   www.iraninfocenter.net
www.electronegar.com
  www.sorna.net
   
- Original Message -
From: eventualdeath [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, November 04, 2001 09:51 AM
Subject: Can I use split to split existing array !


Hi,

I need some clarification :-

Q1)Can I use the split function to split an existing array (with several
elements ) such as the example below.

Q2)Could it be that the split function can only be used to split a
scalar (one element).

Q3)Could someone explain to me the reason why @readagain return the
number 4, and $#readagain return 0.

@read = (hi please, help me, on this , problem);
@readagain = split (/whatever/, @read);

print What happened here, it return 4 =, @readagain,\n;

##



Thanks





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




unusual function..!!

2001-11-03 Thread nafiseh saberi

hi..
I see in many source that...use   print TABLE;  
when want to work with html in cgi...
but I dont find this syntax of print ( print ) in any document of perl..
why ?!!
thx a lot..
  _
  Best regards

  Try to always be hopefull

   www.iraninfocenter.net
www.electronegar.com
  www.sorna.net  
   



Re: Can I use split to split existing array !

2001-11-03 Thread Jeff 'japhy' Pinyan

On Nov 4, eventualdeath said:

Q1)  Can I use the split function to split an existing array (with
several elements ) such as the example below.

No.  split() uses a string.

Q2)  Could it be that the split function can only be used to split a
scalar (one element).

Yup.

Q3)  Could someone explain to me the reason why @readagain return the
number 4, and $#readagain return 0.

split() happens to ENFORCE scalar context on its second argument -- that
means that 

  split /whatever/, @read;

is like

  split /whatever/, scalar(@read);

and scalar(@array) returns the number of elements in the array.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


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




TEMPLETE

2001-11-03 Thread nafiseh saberi

hi...
do u know how can I use templete in perl ??
(now I use html in perl source...)
thx.
  _
  Best regards

  Try to always be hopefull

   www.iraninfocenter.net
www.electronegar.com
  www.sorna.net