Re: Subroutine return values mixed.

2004-06-17 Thread Amit Kulkarni
HI , You need to declare @array "as my @array" after line 14 in subroutine. 13 sub color { 14 $map1 = shift; #NEW LINE- my @array ; 15 foreach $item(keys %$map1) 16 { push @array, $item;} 17 return [EMAIL PROTECTED]; 18} Regards ---

Subroutine return values mixed.

2004-06-17 Thread Khan, Ahmer H
Hi, I'm very new to Perl and am learning as I go along. I've been reading a lot of articles and perl books to enhance my expertise. I'm stuck on a problem where the content of the arrays returned back from a common subroutine call are getting mixed up. Here is the code. --

Re: regex in perl.

2004-06-17 Thread Chris Charley
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=slrnbnjntp.7er.xx087%40smeagol.ncf.ca The link above shows an array of patterns being used. http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&q=%22array+of+patterns%22+group%3Acomp.lang.perl.misc&meta=group%3Dcomp.lang.perl.misc The link a

Tie::Gzip

2004-06-17 Thread Damian Scott
I am new to using Perl and found this module out at CPAN to read gzip'ped files, but I have no idea how to use it. Can someone provide a couple of examples to get me started? TIA. -Damian

Re: making print not wantarray

2004-06-17 Thread WilliamGunther
In a message dated 6/17/2004 5:32:16 PM Eastern Standard Time, [EMAIL PROTECTED] writes: >I knew about that but the problem is most of the users (incuding myself >;p) will want to print it without the same $header info twice and don't >want to have a bunch of print scalar whatevr(); > >If there

Re: making print not wantarray

2004-06-17 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: If the enduser programmer want to force it into scalar context they can: print scalar fooyou(); I knew about that but the problem is most of the users (incuding myself ;p) will want to print it without the same $header info twice and don't want to have a bunch of print s

Re: making print not wantarray

2004-06-17 Thread WilliamGunther
If the enduser programmer want to force it into scalar context they can: print scalar fooyou(); -will http://www.wgunther.tk (the above message is double rot13 encoded for security reasons) Most Useful Perl Modules -strict -warnings -Devel::DProf -Benchmark -B::Deparse -Data::Dumper -Clone -

regex in perl.

2004-06-17 Thread Rod Za
Hello, Someone know how can i search this in a file using regex? %! or \004%! or \033%-12345X%!PS or LANGUAGE=POSTSCRIPT or LANGUAGE = POSTSCRIPT or LANGUAGE = Postscrip Thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam pro

making print not wantarray

2004-06-17 Thread JupiterHost.Net
Howdy group, If you have a function that returns different things based on if they want an array or not how can you force print to be in scalr context? for instance: sub fooyou { my $header = 'whatever'; my $data1 = 'data1'; my $data2 = 'data2'; return ("$header$data1","$header$data2") if

Help with Data Structures

2004-06-17 Thread William Martell
Hello All, I was wondering if someone could tell me how to manipulate this data structure. I have attached the datafile. My code and code results are printed below. If you take a look at the results, you will see that there is a hash created for each interaction in the loop and the results a

Re: Date and time calculation

2004-06-17 Thread Chris Charley
> Hi there, > > I've got a date field and a time field, how can I effectively subtract the > field ($date $time) - ($date2 $time2) from each other. I am using these > two fields to determine a server's uptime according to my database in > days,hours,minutes,seconds. > Kind Regards, > Werner Otto P

Re: find command works different when used in perl script

2004-06-17 Thread sreenath sarikonda
I tried you idea. I sent you the output right. It is searching / etc. I am sending you a modified code and ouput is > > #./passwd.pl > > seraching/ > > /usr/sbin/a.txt > > /scripts/a.txt > > /a.txt > > seraching/ > > /usr/sbin/a.txt > > /scripts/a.txt > > /a.txt > > serach

Re: find command works different when used in perl script

2004-06-17 Thread Sudhir Sambrani
$PATHP is the absolute path of the find utility i guess the difference is bcos the value of $Hme is changing where as at the command line / is constant try printing out the value of $Hme each time to check - Original Message - From: "sreenath sarikonda" <[EMAIL PROTECTED]> To: "

Re: find command works different when used in perl script

2004-06-17 Thread sreenath sarikonda
Please group reply so everyone can help and be helped (and to avoidbeing accidentally ignored). > Wiggins , > Thank you for the reply > You haven't told us what the difference is, but out > > of curiousity why > > are you using $PATHP to start your search, isn't > > that what $Hme is for?

CGI.PM and HTML Templates

2004-06-17 Thread John Pretti
Can someone point me in the right direction of converting the following script to use an html template? #!/usr/bin/perl -w # perlUpload.cgi by John Pretti # Comments/Questions john[at]web-connected.com # Last modified 05/03/04 # Load needed Perl modules use strict; use diagnostics; use CGI; #

Re: find command (chomp)

2004-06-17 Thread Wiggins d Anconia
Please group reply... > before chomping the find command did not work as the > extracted username has a end of line(or somthing I > donno). I gave a email before this and expecting you > mail to get me out of trouble.Thank you. > > > > chomp($Hme); > > chomp($user); > > perldoc -f chomp > > If

Re: find command works different when used in perl script

2004-06-17 Thread Wiggins d Anconia
Please group reply so everyone can help and be helped (and to avoid being accidentally ignored). > Wiggins , > Thank you for the reply > > > You haven't told us what the difference is, but out > > of curiousity why > > are you using $PATHP to start your search, isn't > > that what $Hme is

Re: How to emulate a startup command from within a Perl script?

2004-06-17 Thread Roberto Etcheverry
Look for 'Playing with STDIN and STDOUT' and 'Re-Opening Files (dups)' in perlopentut . Wagner, David --- Senior Programmer Analyst --- WGO said the following on 6/16/2004 2:09 PM: I have a Perl process which runs on solaris under 5.8.3. It is started with the following command:

Re: Perl newbie: regexp

2004-06-17 Thread raj
I am clear. Thanks for replying all. - Original Message - From: "Bob Showalter" <[EMAIL PROTECTED]> To: "'raj'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, June 17, 2004 5:48 PM Subject: RE: Perl newbie: regexp > raj wrote: > > Hello All, > >I am new to perl

Re: find command works different when used in perl script

2004-06-17 Thread Wiggins d Anconia
> Hi everyone, >Below is the script i am using to delete > few files in the list of user home directories. But > for now I am testing this code and just listing. > So the find command gives a different output when used > in bash prompt than when invoked in script. > Any help would be ap

find command works different when used in perl script

2004-06-17 Thread sreenath sarikonda
Hi everyone, Below is the script i am using to delete few files in the list of user home directories. But for now I am testing this code and just listing. So the find command gives a different output when used in bash prompt than when invoked in script. Any help would be appreciated Thak

RE: Replace tab delimited headings in file

2004-06-17 Thread Debbie Cooper
Thanks so much! This is great because I'm new to Perl and your comments make things much easier to understand! Thanks again, Debbie -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:54 PM To: Debbie Cooper Cc: [EMAIL PROTECTED] Subjec

RE: Time

2004-06-17 Thread Wiggins d Anconia
Please bottom post... > Ah good point, I believe I forgot the line: > > $days_in_month[1] = 29 if $printed_year % 4 == 0; > > Better? If not apologies, not sure why that would be :) > Sort of, now it breaks every 100, 400, 1600? years. This is where the argument for using a ready made module

Re: a way to make this more secured and better written?

2004-06-17 Thread Wiggins d Anconia
> Is this how you were talking about getting rid of globals, and does this > seem correct? > > #!/usr/bin/perl -T > > use strict; > use warnings; > > use lib '/home/perl-lib/modules'; > > use CGI; > use Email::Valid; > use Mail::Mailer; > > my $q = CGI->new(); > > print $q->header(); > > che

RE: perl help

2004-06-17 Thread Bob Showalter
jack jack wrote: > Hi All, Hi. Use a meaningful subject. "perl help" is a given on this list. > > > I have 2 variables $last_accessed and $owner_line > $last_accessed=": Last accessed 20-Apr-04.12:57:30 by > [EMAIL PROTECTED]"; > $owner_line="Owner: opc_bld : rwx (all)"; > > -From $l

RE: Perl newbie: regexp

2004-06-17 Thread Bob Showalter
raj wrote: > Hello All, >I am new to perl. I want to display the lines which > have "Testing" word. I have to do this in command line. > > I tried the with following options. Its not work what I expected. It > dispalys all lines. > > perl -p -e 'print if /Testing/m' test.txt -p s

Re: Perl newbie: regexp

2004-06-17 Thread Roberto Etcheverry
This will do it: perl -n -e 'print if /Testing/m' test.txt '-p' prints every line in the file so you'll see the matching lines twice (one because of '-p' and the other because of 'print') and the non-matching lines once (because of '-p'). Look in 'perldoc perlrun' for differences on '-p' and '-

perl help

2004-06-17 Thread jack jack
Hi All, I have 2 variables $last_accessed and $owner_line $last_accessed=": Last accessed 20-Apr-04.12:57:30 by [EMAIL PROTECTED]"; $owner_line="Owner: opc_bld : rwx (all)"; -From $last_accessed i want the foll output in variables : $view_day=20 $view_month=Apr $view_year=04 -From

Perl newbie: regexp

2004-06-17 Thread raj
Hello All, I am new to perl. I want to display the lines which have "Testing" word. I have to do this in command line. I tried the with following options. Its not work what I expected. It dispalys all lines. perl -p -e 'print if /Testing/m' test.txt ANy help much appreciated! Reg

Re: How to creating a package.

2004-06-17 Thread Randy W. Sims
Rod Za wrote: what the 'bless' do? A brief introduction to bless: More info can be found in the tutorials included with perl: perlboot perltoot perltooc perlbot perlmod perlmodlib perlmodstyle perlnewmod Also check out the "Online Library" secti

Re: a way to make this more secured and better written?

2004-06-17 Thread Jason Gray
Is this how you were talking about getting rid of globals, and does this seem correct? #!/usr/bin/perl -T use strict; use warnings; use lib '/home/perl-lib/modules'; use CGI; use Email::Valid; use Mail::Mailer; my $q = CGI->new(); print $q->header(); check_fields($q); sub check_fields { my

RE: Time

2004-06-17 Thread Chris Welch
Ah good point, I believe I forgot the line: $days_in_month[1] = 29 if $printed_year % 4 == 0; Better? If not apologies, not sure why that would be :) > -Original Message- > From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] > Sent: 16 June 2004 01:18 > To: [EMAIL PROTECTED] > Cc: [EMAIL

Re: recursive replace

2004-06-17 Thread George Georgalis
On Wed, Jun 16, 2004 at 05:02:03AM -0400, Randy W. Sims wrote: >George Georgalis wrote: >>On Mon, Jun 14, 2004 at 04:42:40PM -0500, JupiterHost.Net wrote: >> >>> >>>George Georgalis wrote: >>> >>> In my perl notes I found this for recursive replace I want to replace all instances o