Re: variable scope over multiple files

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, Birgit Kellner wrote: > If I have one script that requires another and I want to make the former's > global variables available in the latter, and have use strict NOT complain, > what should I do? Perhaps I should not use "require", but "use"? IMHO, the proper way to do this

Re: Date Validation Regex

2001-08-10 Thread Peter Scott
At 08:17 PM 8/10/01 +0530, sachidanand haldankar wrote: >Hi Peter, > >Thanks for ur quick response. Its seems to be working fine. Thanks a > lot for that. What I am trying to do is to write a Regex for date > validation in a xml file used in CMS environment(using InterWoven). There > is a a

RE: skrptX.pl inp.txt--->reportX.shtml

2001-08-10 Thread John Edwards
Is this to create dynamic web pages using CGI? Or are you trying to run the perl script to create a static html file from the text file? John -Original Message- From: Thomas Burkhardt [mailto:[EMAIL PROTECTED]] Sent: 10 August 2001 17:36 To: Perl Help Subject: skrptX.pl inp.txt--->report

skrptX.pl inp.txt--->reportX.shtml

2001-08-10 Thread Thomas Burkhardt
Greetings Perl Gurus! Problem: Converting text to html using a perl script. I have an operational perl script that I run on the command line like so: > skrptX.pl In the same CWD I have an input file called "inp.txt". Lets say it is merely a one column list of names. The script I have wr

variable scope over multiple files

2001-08-10 Thread Birgit Kellner
I am using a script to manage flatfile databases which consists of several perl files: a central perl script contains all subroutines for data manipulation, another script prints out html code, and a configuration file sets all global variables like for instance $db_script_path for the directo

getpwent & getgrent

2001-08-10 Thread Baartmans, Hans
Are there any equivalent functions for getpwent or getgrent in the NIS environment? I am able to get the local password information using these functions. Can they be extended to query the NIS information? Thanks!

Re: result of regexps into a string

2001-08-10 Thread Romek KrisztiƔn
Hello Chasey and Akshay! > You could use a regex: > > $log_line =~ /([\d.]+)\s/; > my $ip_addr = $1; > IP numbers have the format ddd.ddd.ddd.ddd ranging from 1 to 3 digits, > so > if(/$(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) would grab the IP and put it > in $1 > the above will match IP numb

RE: PERL installation guide for VMS?

2001-08-10 Thread Bill Odom
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] said: > > I didn't find the installation guide for PERL/VMS. The > Freeware V4 CD does not have anything useful but copies of > memos dated 1995 and among the 813 files of the 5-003-05 > kit, I only found this which may help, and it actually does not >

RE: Win32::Eventlog on ActiveState

2001-08-10 Thread Chris Garringer
Aaargh Comes from looking at your own code too long. Thanks. Chris D. Garringer LAN/WAN Manager Master Certified Netware Engineer Microsoft Certified Systems Engineer Certified Solaris Administrator Red Hat Certified Engineer [EMAIL PROTECTED] fax 713-896-5266 >>> "Bill Odom" <[EMAIL PRO

Re: Converting dos 2 unix with a regexp

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, Michael Wolfrom wrote: > My question is: How can a match the ^M at the end of a dos text file > in a regexp? > What I am trying to do is print all the characters up until the ^M (if > there is one). \cM is how you can match it on a regexp. Some people also use \r. you c

RE: Repetitive code

2001-08-10 Thread Ross, Jonathan C.
> I don't want to duplicate code. However, system2 has > two compilers and I need to read each compiler's > password file and store that data in a hash. Now, > will the compiler_data hash contain the data for both > compilers password files? How can I keep them > separate and don't duplicate c

Converting dos 2 unix with a regexp

2001-08-10 Thread Michael Wolfrom
My question is: How can a match the ^M at the end of a dos text file in a regexp? What I am trying to do is print all the characters up until the ^M (if there is one). Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: grep repetitive elements?

2001-08-10 Thread Jennifer Pan
thanks all! This works, and I am reading Perl cookbook. -Original Message- From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 10:44 AM To: Jennifer Pan Cc: [EMAIL PROTECTED] Subject: Re: grep repetitive elements? On Aug 10, Jeff 'japhy/Marillio

RE: Win32::Eventlog on ActiveState

2001-08-10 Thread Bill Odom
Chris Garringer [mailto:[EMAIL PROTECTED]] said: > > I need to read a Win2k Event log (Application). > ... > I got the Win32::Eventlog module and setup per the documentation > ... > use Win32::Eventlog; > ... > I get a compile-time error > Can't locate object method new via package > "Win32::Event

Re: grep repetitive elements?

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Jeff 'japhy/Marillion' Pinyan said: > my %freq; > $freq{$_}++ for @list2; # create a hash of key -> frequency > > for (@list1) { >print $freq{$_} if $freq{$_} > 1; > } Rather, print $_ if $freq{$_} > 1; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.

RE: grep repetitive elements?

2001-08-10 Thread Bob Showalter
> -Original Message- > From: Jennifer Pan [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 10, 2001 10:20 AM > To: [EMAIL PROTECTED] > Subject: grep repetitive elements? > > > I have two list, > @list1 and @list2, each element @list1 is unique (could be a hash I > suppose) > > I want

Re: number of elements in array is -1?

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, Tyler Longren wrote: > I did: > print "$scans[0]"; > and nothing is printed...where 192.168.1.1 SHOULD be printed... > here's what I have: > open (LOGFILE, $log_file) || die ("Could not open $log_file: $!"); > my @array; > while () { > chomp; > push (@array, $_) >

Re: grep repetitive elements?

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, Jennifer Pan wrote: > I have two list, > @list1 and @list2, each element @list1 is unique (could be a hash I > suppose) > > I want to find out all the elements @list2 that is an element in list1 > and have appeared two or more times I would break this down algorithmically in

Re: grep repetitive elements?

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Jennifer Pan said: >I have two list, >@list1 and @list2, each element @list1 is unique (could be a hash I >suppose) > >I want to find out all the elements @list2 that is an element in list1 >and have appeared two or more times > >I want to use GREP but I don't know how to grep certain

Re: number of elements in array is -1?

2001-08-10 Thread Tyler Longren
Ahh...I just started wondering if it stopped at the end of the file...That should fix it then. Thank you everyone On Fri, 10 Aug 2001 09:31:36 -0500 Mooney Christophe-CMOONEY1 <[EMAIL PROTECTED]> wrote: > I thought so. You read through the entire file, so by the time you get > to > your se

Re: number of elements in array is -1?

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Tyler Longren said: >while () { > chomp; > push (@array, $_) > if m/ida/i; >} >while () { > push (@scans, $_) > if m/$last_host/i; >} Is there a reason you didn't put both of those into ONE while block? It would be far more efficient (and it would work). Th

RE: number of elements in array is -1?

2001-08-10 Thread Mooney Christophe-CMOONEY1
I thought so. You read through the entire file, so by the time you get to your second while loop, you're at the very end of the file. You need to rewind. -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 9:29 AM To: Brett W. McCoy Cc: [EMAIL

Re: number of elements in array is -1?

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Tyler Longren said: >my @scans; >my $last_host = "192.168.1.1"; >while () { > push (@scans, $_) > if m/$last_host/i; >} Your regex matches things like "19271683101". Perhaps you want: push @scans, $_ if /\Q$last_host\E/; The /i modifier is useless here, and the \Q...\E

RE: number of elements in array is -1?

2001-08-10 Thread Bob Showalter
> -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 10, 2001 10:19 AM > To: Perl-Beginners > Subject: number of elements in array is -1? > > > Hello everyone, > > I have a problem. I just want to print the number of elements in an > array. Here

Re: number of elements in array is -1?

2001-08-10 Thread Tyler Longren
I did: print "$scans[0]"; and nothing is printed...where 192.168.1.1 SHOULD be printed... here's what I have: open (LOGFILE, $log_file) || die ("Could not open $log_file: $!"); my @array; while () { chomp; push (@array, $_) if m/ida/i; } my $last_host = "192.168.1.1"; my @scans;

Re: number of elements in array is -1?

2001-08-10 Thread Tyler Longren
well, no, I'm not checking. But it is open correctly because I use it earlier in the script and it never gets closed until the very end. On Fri, 10 Aug 2001 09:22:11 -0500 Mooney Christophe-CMOONEY1 <[EMAIL PROTECTED]> wrote: > if $#scans==-1, then the array is empty (of course!) > > Are you

grep repetitive elements?

2001-08-10 Thread Jennifer Pan
I have two list, @list1 and @list2, each element @list1 is unique (could be a hash I suppose) I want to find out all the elements @list2 that is an element in list1 and have appeared two or more times I want to use GREP but I don't know how to grep certain element only when it happens >2 times,

Re: Translating an octet string...

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Jeff 'japhy/Marillion' Pinyan said: > my $len = length $output; > my $i = 0; > while ($i < $len) { >print substr($output, 8 * $i++, 8), " "; > } Oops. The condition of the while loop should be: while ($i * 8 < $len) { ... } -- Jeff "japhy" Pinyan [EMAIL PROTECTED]

Re: number of elements in array is -1?

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, Tyler Longren wrote: > I try to show the number of elements in the array like so: > print "$#scans"; That actually gives the index of the last element, not the actual count of elements. You want: print scalar(@scans); > But that prints "-1". I know for a fact there are a

RE: number of elements in array is -1?

2001-08-10 Thread Mooney Christophe-CMOONEY1
if $#scans==-1, then the array is empty (of course!) Are you checking to make sure LOGFILE opened correctly? -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 9:19 AM To: Perl-Beginners Subject: number of elements in array is -1? Hello ever

Re: Is there any function for converting uppercase characters tolowercase chars ?

2001-08-10 Thread Brett W. McCoy
> Is there any function for converting uppercase characters to lowercase > chars ? Of course! perldoc -f uc perldoc -f lc perldoc -q capital -- Brett http://www.chapelperilous.net/btfwk/

Re: Translating an octet string...

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Hamish Whittal said: >I have an octet string that I need to print. When I print it, I get some >rubbish on the screen. I would therefore like to translate this to >something printable. > >e.g I have 11011010110001001011 and I want to print this as 11011010 >1000100 1011 You wa

number of elements in array is -1?

2001-08-10 Thread Tyler Longren
Hello everyone, I have a problem. I just want to print the number of elements in an array. Here's the code: my @scans; my $last_host = "192.168.1.1"; while () { push (@scans, $_) if m/$last_host/i; } shouldn't that put all of the results into the @scans array? I know there'd just

RE: Is there any function for converting uppercase characters to lowercase chars ?

2001-08-10 Thread Chris Rogers
Try: print "\L$variable"; This will print the entire string in lowercase. print "\U$variable"; This will print the entire string in uppercase. -Original Message- From: Rahul Garg [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 10:20 AM To: [EMAIL PROTECTED] Subject: Is t

Re: Is there any function for converting uppercase characters tolowercase chars ?

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Rahul Garg said: >Is there any function for converting uppercase characters to lowercase >chars ? The lc() function. It returns a lowercased version of the string you pass it. Please read 'perldoc -f lc'. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~jap

Translating an octet string...

2001-08-10 Thread Hamish Whittal
Hello all, I have an octet string that I need to print. When I print it, I get some rubbish on the screen. I would therefore like to translate this to something printable. e.g I have 11011010110001001011 and I want to print this as 11011010 1000100 1011 Any clews on how to do this? Tha

Is there any function for converting uppercase characters to lowercase chars ?

2001-08-10 Thread Rahul Garg
Hello, Is there any function for converting uppercase characters to lowercase chars ? Thanks Rahul

Win32::Eventlog on ActiveState

2001-08-10 Thread Chris Garringer
I need to read a Win2k Event log (Application). I am running Active State (downloaded last week) on this machine. I got the Win32::Eventlog module and setup per the documentation (I think) use strict; use Win32::Eventlog; .. $Win32::Eventlog::GetMessageText=1; my $evtflags=$Win32::Eventlog::E

Re: Creating XML Doctype from tab-delimited file input?

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, Chris Garaffa wrote: > I have a few files containing references to 186,000 graphics from Extensis > Portfolio that I need to import into FileMaker Pro. We've already decided > the best way is via importing an XML file. I have an idea on how to get > the data into an XML file

Help with Mail::Sender package

2001-08-10 Thread Ajit Tawde
I am using ActiveState perl on Windows NT 4.0 platform. I want to send emails with attachments. I have downloaded package Sender.pm and copied it to my c:\perl\lib\mail folder. Do I need to do anything special to install it ? When I use it in the following script : use Mail::Sender;

RE: It's your fault pt.2

2001-08-10 Thread John
thanks for the explanation. wish i could have received this information from beginners@perl though. if I can assist you with something perl/cgi/java/html/dhtml-wise at some given time, I would do so to repay the favor. again, thanks, John -Original Message- From: Dave Newton [mailto:[EMA

Re: Scope, priority or bug?

2001-08-10 Thread Ivan Adzhubei
Hello Bob, > I think the answer can be found in the following statement in the persub > manpage > under the heading "Private Variables via (my)": Yes, I read this (sorry for typing error, perlsub should be cited in my initial message instead of perlvar). Unfortunately, the following passage

Creating XML Doctype from tab-delimited file input?

2001-08-10 Thread Chris Garaffa
Hi everyone, I have a few files containing references to 186,000 graphics from Extensis Portfolio that I need to import into FileMaker Pro. We've already decided the best way is via importing an XML file. I have an idea on how to get the data into an XML file and it seems to work (in theory -

Re: Scope, priority or bug?

2001-08-10 Thread Ivan Adzhubei
Hello Jos, "Jos I. Boumans" wrote: > > let's see if i can shed some light on this. > > your statement: > print("Defined: <<$z>>\n") if defined(my $z="x"); > > this will be evaluated like this if i'm not mistaken: > ( print("Defined: <<$z>>\n") ) && defined(my $z="x"); > > or a simplistic

Re: Fw: changes visible when passing a list by value

2001-08-10 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 10, Rizwan Majeed said: >It is known that passing a list by value to a function does not make >visible to the calling function changes made to the list. > >But I dont understand how does the push() function works. Push takes >the value of a list and still makes visible to the calling block

Re: Please post serial port communication example

2001-08-10 Thread Brett W. McCoy
On Fri, 10 Aug 2001, chris morris wrote: > I'm sorry I was not clear. Could someone please post an example script of > a generic opening, reading, and writing to a serial port on a Linux > system? I'd like to see how to configure the port (baud rate, stop bits, > etc.) Thanks. On Linux, I'd use

Please post serial port communication example

2001-08-10 Thread chris morris
I'm sorry I was not clear. Could someone please post an example script of a generic opening, reading, and writing to a serial port on a Linux system? I'd like to see how to configure the port (baud rate, stop bits, etc.) Thanks. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROT

RE: confused over cookbook example 6-2

2001-08-10 Thread Bob Showalter
> -Original Message- > From: Cohan, Drew [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 10, 2001 8:32 AM > To: '[EMAIL PROTECTED]' > Subject: confused over cookbook example 6-2 > > > I'm trying to modify cookbook example 6-2: > > #killtags: very bad html tag killer > undef $/; > whil

Re: confused over cookbook example 6-2

2001-08-10 Thread Jos I. Boumans
are you sure your input is what you expect it to be? maybe print out all the lines? and if you like, i wrote a very basic and simple html parser. you can get it here: http://japh.nu/index.cgi?base=modules take a look at the source, it should probably explain a lot hth Jos > I'm trying to modi

TEST do not reply

2001-08-10 Thread didier . morandi
nothing -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

confused over cookbook example 6-2

2001-08-10 Thread Cohan, Drew
I'm trying to modify cookbook example 6-2: #killtags: very bad html tag killer undef $/; while(<>){ s/<.*?>//gs; print; } to instead look for all "href=" in an html file across paragraphs/newlines but I only get the first successful match. why does the cookbook's work but not mi

RE: Scope, priority or bug?

2001-08-10 Thread Bob Showalter
> -Original Message- > From: Ivan Adzhubei [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 10, 2001 7:24 AM > To: [EMAIL PROTECTED] > Subject: Scope, priority or bug? > > > Hi! > > Isn't this weird? > > #!/usr/bin/perl -w > print("Defined: <<$z>>\n") if defined(my $z="x"); > print "A

Re: Scope, priority or bug?

2001-08-10 Thread Jos I. Boumans
let's see if i can shed some light on this. your statement: print("Defined: <<$z>>\n") if defined(my $z="x"); this will be evaluated like this if i'm not mistaken: ( print("Defined: <<$z>>\n") ) && defined(my $z="x"); or a simplistic version: (print $z) && (my $z = 'bar'); try and 'use strict'

PERL installation guide for VMS?

2001-08-10 Thread didier . morandi
Hi, I'm a new folk in the beginners team. I didn't find the installation guide for PERL/VMS. The Freeware V4 CD does not have anything useful but copies of memos dated 1995 and among the 813 files of the 5-003-05 kit, I only found this which may help, and it actually does not help at all (and

Scope, priority or bug?

2001-08-10 Thread Ivan Adzhubei
Hi! Isn't this weird? #!/usr/bin/perl -w print("Defined: <<$z>>\n") if defined(my $z="x"); print "Assigned: <<$z>>\n"; Produces: Defined: <<>> Assigned: <> So it looks like $z *is* defined but *not* assigned until we are out of the 'if' statement. Is it a bug? My understanding it should eithe

Re: problems with a for-loop

2001-08-10 Thread Ray Barker
Hi Birgit-- I am probably missing something, but the thing I see is that you have used the my keyword inside your loop in this statement: > my @db_cols = @cols; # now we set the field names to those of db2 which we > my ($status2, @hits2) = &query('view'); # sub query does the actual search tha

Re: Fw: changes visible when passing a list by value

2001-08-10 Thread Michael Fowler
On Fri, Aug 10, 2001 at 10:42:32AM +0500, Rizwan Majeed wrote: > It is known that passing a list by value to a function does not make > visible to the calling function changes made to the list. That isn't necessarily true. The code: sub my_push (\@@) { push(@{ $_[0] }, @_[1 .. $#_]) }

Re: PERL_LIB Questions

2001-08-10 Thread Michael Fowler
On Fri, Aug 10, 2001 at 12:11:43AM -0500, Teresa Raymond wrote: > If you don't have the access to install a module in the root > directory, this is the way you can do it - unless you ask the web > host to install the module you want specifically. I was talking about installing the module in a u