Re: global variables

2001-09-24 Thread Sascha Kersken
Hi! Perl 5.6 provides the 'our' statement as opposite to 'my': it makes a variable global to a file in which it's used. HTH Sascha - Original Message - From: "Ruth Albocher" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 24, 2001 1:01 PM Subject: global variables

Re: regex help with wildcards

2001-08-20 Thread Sascha Kersken
Hi! What about just doing $string =~ s/<[^>]+>//; which will match any number of chars that AREN'T ">" and a ">" behind that. Sascha At 12:06 20.08.01 +0200, you wrote: >Im not sure if this is possible but i want to delete all chars inbeteen >< and > so if i had id like to delete it, >Her

Re: append to beginning of file

2001-08-15 Thread Sascha Kersken
Hi. What you should do is write both your new data and the contents of the old file to a new file. Afterwards, you might rename the new file to replace the old one. Like: #!/usr/bin/perl -w open (NEWFILE, ">your new file's name") or die "Couldn't open new file: $!"; print NEWFILE $new_data; # .

Re: perl interpreter

2001-08-01 Thread Sascha Kersken
Hi! You just CAN'T. What you have to do is install a Perl interpreter on each computer you want to run Perl scripts on. The best - and most easily to install - distribution for Windows systems is ActivePerl which can be downloaded at www.activestate.com Sascha -- >Von: Matthias Stauding

Re: running CGI on a stand alone machine

2001-07-30 Thread Sascha Kersken
Hi! Your code looks OK. What you need is a LOCAL web server installed on your computer (please note that a web server is SOFTWARE, basically). You can get, e.g., Apache for many platforms, including all Windows versions, at www.apache.org . Then, you need a Perl interpreter, too. For Windows, Act

Re: counting files of a directory

2001-07-30 Thread Sascha Kersken
Hi! I'm not aware of a FUNCTION to do it, but this should work: DIR = opendir ("path/to/dir"); $count = 0; while (readdir DIR) { $count++; } - afterwards, $count's value is the number of directory entries. Sascha -- >Von: COLLINEAU Franck FTRD/DMI/TAM <[EMAIL PROTECTED

Re: errors

2001-07-27 Thread Sascha Kersken
I see. Maybe you should post a bit more of it than just the relevant lines. I just notice that now, you're talking about $input while the script reads $INPUT - and that, of course, makes a difference. Sascha -- >Von: "Sally" <[EMAIL PROTECTED]> >An: "S

RE: errors

2001-07-27 Thread Sascha Kersken
Hi again! Concatenation means that several strings are tied together as one. The usual way to do this in Perl is using the '.' operator: my $string1 = "Hello "; my $string2 = "World"; my $string3 = $string1.$string2; In your code, you DON'T actually use the '.' operator. But you are in fac

RE: errors

2001-07-27 Thread Sascha Kersken
Hi! As it seems, you're trying to run a CGI script directly from the console - so the script doesn't know what to do with the CGI environment variable CONTENT_LENGTH, and later on, it doesn't know the hash %INPUT either, which seems to be the input that was submitted from a HTML form. This scrip

RE: Linux commands in perl

2001-07-25 Thread Sascha Kersken
Hi! Try: system "command"; -- >Von: "Rahul Garg" <[EMAIL PROTECTED]> >An: <[EMAIL PROTECTED]> >Betreff: Linux commands in perl >Datum: Mit, 25. Jul 2001 10:44 Uhr > > hello Everybody , > > > Simple question.. > > How to run Linux commands in Perl code... > > W

Re: Which perl book is the best for a newbie?

2001-07-25 Thread Sascha Kersken
Hi! I think the best one is "Learning Perl" by Randal L.Schwartz an Tom Christiansen, from O'Reilly. Sascha -- >Von: "Super Newbie" <[EMAIL PROTECTED]> >An: <[EMAIL PROTECTED]> >Betreff: Which perl book is the best for a newbie? >Datum: Mit, 25. Jul 2001 9:41 Uhr > > Which Perl book i

Re: date help

2001-07-24 Thread Sascha Kersken
Hi Shweta! Usually, in the directory where you unpacked the module, you should type the following commands, one after the other: perl Makefile.pl make make install - and that's it. Sascha - Original Message - From: shweta shah To: [EMAIL PROTECTED] Sent: Tuesday, July 24, 2

RE: how to get date before say 20 days ?

2001-07-24 Thread Sascha Kersken
Hi! The module Date::Calc provides a function AddDelta_Days(). It works like: ($year,$month,$day) = Add_Delta_Days($year,$month,$day, $Dd); where the result is a list consisting of year, month and date; the arguments to the function are another year, month, date and a difference number of d

Re: Highlihting a string

2001-07-20 Thread Sascha Kersken
Hi! Unfortunately, we don't learn for what kind of environment you want it *highlighted*. Is it a CGI/web site thing using or tags, or just a plain text environment where you could "highlight" by putting _underscores_ or *asterisks* around the text or using CAPITALS. The following subroutine,

Re: Using CGI.pm

2001-07-19 Thread Sascha Kersken
Hi! That $a in the first script, to me, looks like an OO-style CGI Query object. This has to be created before use: $a = new CGI; Sascha Original Message: > Randal, Brian, Stephen, > Thanks a bunch for your help with my parsing script. I appreciate it very > much. Here's another pr

Re: perl and internet files

2001-07-19 Thread Sascha Kersken
Hi! There's the wonderful recipe 20.5 ("Converting HTML to ASCII") in Chapter 20 ("Web Automation") of the "Perl Cookbook" (by Tom Christiansen and Nathan Torkington, from O'Reilly). A basic way to achieve the ripping of HTML tags and the replacement of and tags by line breaks might be somethi

Re: question

2001-07-19 Thread Sascha Kersken
Hi! The general site for this is learn.perl.org There, you might like to subscribe to beginners-digest instead, which contains much less traffic. The web archive of the beginners' mailing list is at http://archive.develooper.com/beginners%40perl.org/ Besides, your e-mail client (M$ Outlook

Re: What is a HERE Document?

2001-07-19 Thread Sascha Kersken
Hi! A HERE document is a very fine feature of Perl that makes it easy to handle long, multi-line strings. Like so: print << "MYLABEL"; All of this rubbish will be printed including the line wraps until it finds MYLABEL - the word 'MYLABEL' won't print anymore. It's just a signal, that the end o

Re: Parsing a file

2001-07-19 Thread Sascha Kersken
whoops! I think I missed something important: The line if /^tftpd/ should be if (/^tftpd/) of course! Sascha -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Parsing a file

2001-07-19 Thread Sascha Kersken
Hm. I understand the first part of what you ask, the thing about reading the whole file and see whether the last line begins by tftpd or not. This should work like this - although it's not _too_ elegant : #!/usr/bin/perl -w open SYSLOG, ") {} # do nothing until the last line is there! chomp; if

Oops! (was Re: if then and perl)

2001-07-18 Thread Sascha Kersken
Oops! I just discovered a little mistake made by quick copy'n'paste. The line elsif ($url =~ /^http:\/\//i) should read elsif ($url =~ /^ftp:\/\//i) of course. Sascha -- "We Apologize For The Inconvenience" (God's Last Message To His Creation by Douglas Adams)

Re: looking at rows in text files

2001-07-18 Thread Sascha Kersken
Hi! Just try #!/usr/bin/perl -w open DFILE, ") { chomp; s/([^\s]+)*/$1/; print; } close DFILE; - this will rip the rest off from each line when the first white space is encountered. Sascha -- >Von: "Tyler Longren" <[EMAIL PROTECTED]> >An: "Perl Beginners" <[E

Oops! (was Re: if then and perl)

2001-07-18 Thread Sascha Kersken
Oops! I just discovered a little mistake made by quick copy'n'paste. The line elsif ($url =~ /^http:\/\//i) should read elsif ($url =~ /^ftp:\/\//i) of course. Sascha -- "We Apologize For The Inconvenience" (God's Last Message To His Creation by Douglas Adams)

Re: if then and perl

2001-07-18 Thread Sascha Kersken
Hi! This looks a bit strange to me. I wonder how this could ever have run on UNIX - your problem is not a matter of NT or UNIX, but the script is quite buggy ;-). Try this one - it works: #!/usr/bin/perl -w print "Enter the full name of the file you are looking for:\n" ; $url=;