Re: cisco log parsing

2002-05-27 Thread Janek Schleicher
Hernan Marcelo Salvarezza wrote at Mon, 27 May 2002 16:30:38 +0200: > Hello all i am parsing a cisco cdr log and i am having some problems to create the >adecuate regexp > > the log goes like this > > May 16 08:03:58 10.0.0.1 38#0015556, SetupTime 11:06:31.062 DisconnectTime >11:10:06.

Re: can some one help me out with this

2002-05-27 Thread Janek Schleicher
David Vd Geer Inhuur Tbv Iplib wrote at Mon, 27 May 2002 16:59:24 +0200: > open(FH, "<$file"); > while { > s/(/(\n/g > s/\n)/)/g > push @newoutput > } > close FH; > > open(HH, ">$file"); > print HH @newoutput; > close HH; > > > It's untested, you might need to add some ba

Re: Counter and scoping(?) issue

2002-05-29 Thread Janek Schleicher
Camilo Gonzalez wrote at Tue, 28 May 2002 19:45:53 +0200: > Gurus, > > I've been having this problem in various permutations throughout my Perl life. For >this particular > function, I set $confirm_counter to 1. Then I use a foreach loop to send email to >multiple > recipients. Within the for

Re: Reading a binary file

2002-06-01 Thread Janek Schleicher
Octavian Rasnita wrote at Fri, 31 May 2002 11:01:38 +0200: > Hi all, > > I want to upload a binary file. I know how and the upload works fine. However, I >don't know how > many bytes is ok to read at a time. > > I've seen in most examples that 1024 bytes number is used like: > > while ($bytes

RE: Replacing with Regular expressions

2002-06-04 Thread Janek Schleicher
Scot Robnett wrote at Tue, 04 Jun 2002 05:13:13 +0200: >> $foo =~ s/\W*/_/g; >> >> http://www.oreilly.com/catalog/regex/ > ... > > I want to allow only the a-z, A-Z, and 0-9 characters and I want to replace all >others with _ when > writing the file to the server. > > Can you tell m

RE: Replacing with Regular expressions

2002-06-04 Thread Janek Schleicher
Scot Robnett wrote at Tue, 04 Jun 2002 16:46:26 +0200: >> He said he wanted to replace all nonalphanumerics, and I was assuming that meant >white space as >> well, regardless of where in the string it is located. >> >> Scot > >>> $foo =~ s/\W*/_/g; >>> >>> http://www.oreilly.com/catalo

beginners-cgi@perl.org

2002-06-05 Thread Janek Schleicher
Kevin Christopher wrote at Wed, 05 Jun 2002 04:58:38 +0200: > Yes, you can call subroutines either way, with or without the "&". The only case >when the > subroutine must be prefixed with an ampersand is, I believe, when you're assigning a >reference > variable, eg: > > $reference_x = \&subrou

Re: Why using use strict;

2002-06-05 Thread Janek Schleicher
Octavian Rasnita wrote at Tue, 04 Jun 2002 08:03:21 +0200: > Hi all, > > I know why I should use "use strict;" but what happen if I use "use strict;" then >if the code is > OK, I delete this line? > use strict has (e.g.) the benefit for checking for undef values. They can come from the inpu

beginners-cgi@perl.org

2002-06-06 Thread Janek Schleicher
Bob Showalter wrote at Wed, 05 Jun 2002 15:30:29 +0200: > > 3. Don't use the &foo or &foo(args) calling styles. > Allthough I would miss it a little bit. I find the &foo style useful when implementing a little polymorphic subroutine. Example: sub foo { /NUMERIC/&& &_foo_n

Re: How to use a module depending on a condition (was: What am I doing wrong?)

2002-06-07 Thread Janek Schleicher
Octavian Rasnita wrote at Fri, 07 Jun 2002 05:00:33 +0200: > ... > The important code with problem is: > > if ($^O =~ /MSWin/i) { > print "The OS is: $^O"; > #This line is not printed because the OS is Linux but the following line has >problems > use Net::SMTP; > ... > How can I avoid Linux c

Re: Is it a bug in Perl?

2002-06-07 Thread Janek Schleicher
Octavian Rasnita wrote at Wed, 05 Jun 2002 14:18:42 +0200: > ... > Then I've seen one more error in that file: > Argument "\n" isn't numeric in numeric eq (==) at c:/Perl/lib/perl5db.pl line 572 > > That line is: > for ($i = $line + 1; $i <= $max && $dbline[$i] == 0; ++$i) { #{ vi > > Is t

Re: Sorting a hash by values?

2002-06-08 Thread Janek Schleicher
Octavian Rasnita wrote at Fri, 07 Jun 2002 21:54:02 +0200: > I want to make a script that sorts the values from a hash. my @sorted_values = sort {$a <=> $b} values %hash; > > I want to make a "top with the most downloaded files". > > I know how to sort the hash by keys but I couldn't sort it

Re: mysql query statement

2002-06-09 Thread Janek Schleicher
Hytham Shehab wrote at Fri, 08 Jun 2001 15:10:19 +0200: > hi all of u, > i got a simple question, why (1) is valid, however, (2) is not ?!! > (1) sorting order is explicity typed in the query statement: > $sth = $dbh->prepare("select student_name from students order by first_name > asc"); >

Re: At least a number of characters - regular expressions

2002-06-10 Thread Janek Schleicher
Octavian Rasnita wrote at Sun, 09 Jun 2002 08:42:34 +0200: > Hi all, > > I want to check if in a string there are more than 3 capital letters. I've tried >using: > > if ($string=~ /[A-Z]{3,}/) { > > } > } > This match at least 3 capitals only if they are one after another. I want to check

Re: single quotes kill my scripts

2002-06-11 Thread Janek Schleicher
Rob Roudebush wrote at Tue, 11 Jun 2002 03:07:44 +0200: > I have the following code - when someone enters a whatever ' whatever into one of >my forms my > script dies because of the single quote. Aggg... of course the first time I >come across it is > when my boss is testing out the sc

Re: form display problem

2002-06-11 Thread Janek Schleicher
Alaric Joseph Hammell wrote at Tue, 11 Jun 2002 18:06:46 +0200: > So, I have these two subroutines, match_state() and display_form that I am having >problems with. > If the script is run with $state getting the function > > argument, it prints a blank pulll-down menu and is able to print "Quad

Re: Example for "uniq"

2002-06-11 Thread Janek Schleicher
Jonathan Gines wrote at Tue, 11 Jun 2002 17:29:38 +0200: > ... > # read data > # > $foo{$data]++; #count data. new values = 1, previously read values are >incremented by 1 ^ } :-)) Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

Re: form display problem

2002-06-12 Thread Janek Schleicher
Ahammell wrote at Wed, 12 Jun 2002 05:32:19 +0200: > Janek Schleicher wrote: >> It's a real crime to copy source code. I missed to say :-). Sorry. >> Here you see why. >> >> Cheerio, >> Janek >> >> > Jan

Re: Uploading Help

2002-06-14 Thread Janek Schleicher
Links On Web wrote at Fri, 14 Jun 2002 07:20:17 +0200: > for some reason when, I do this it doesnt print any thing, it just makes the file. > > sub uploadfile { > for ($i=1; $i<=5; $i++) { > if ($q->param("file$i")) { > $filename = $q->param("file$i"); > $file = $q->param("

Re: Uploading Help

2002-06-14 Thread Janek Schleicher
Ovid wrote at Fri, 14 Jun 2002 16:43:51 +0200: > It would seem that way, but this is not the case. From the CGI.pm documentation: > > When the form is processed, you can retrieve the entered filename by calling >param(): > >$filename = $query->param('uploaded_file'); > > [

Re: exit from subs // creating frames

2002-06-20 Thread Janek Schleicher
Root wrote at Thu, 20 Jun 2002 14:04:30 +0200: > ok, found a solution to display the framessets > although it works just fine, I would really appreciate comments etc on how to >optimize the code :) > ... > my $path_info = $q->path_info; > > > if (!$path_info) { > &frameset; > exit 0; > } > } >

Re: Random images on a bulletin board

2002-07-03 Thread Janek Schleicher
Connie Chan wrote at Wed, 03 Jul 2002 08:19:19 +0200: > PS. You may run your script in shell ( perl yourscript.pl ), before you go on with >the web > browser... So it will direct tell you the syntax error at which line.. It saves your >time to > debug Or to use a module doing this job: us

Re: server push

2002-07-06 Thread Janek Schleicher
Hytham Shehab wrote at Sat, 06 Jul 2002 20:04:50 +0200: > #!c:/perl/bin/perl.exe > [snipt 50 lines of code] > -- > Hytham Shehab > btw, i know, there is more perlish way to write this. O.K. What's your question ? Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional co

Re: How to add " "

2002-07-07 Thread Janek Schleicher
Henk Van Ess wrote at Sun, 07 Jul 2002 11:12:48 +0200: > So basically, I want to change > > userinput > > into > > "userinput" $userinput = qq/"$userinput"/; Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Odd boxes after uploading

2002-07-07 Thread Janek Schleicher
Henk Van Ess wrote at Sun, 07 Jul 2002 16:27:42 +0200: > This is the script: > > #!/usr/bin/perl > > print "Content-type:text/html\n\n"; ^^ I'm not sure, whether it plays a role, but it seems that a blank is missed: print "Content-type: text/html\n\n"; Best Wishes, Janek

Re: trying to find direcotries

2002-07-08 Thread Janek Schleicher
Links On Web wrote at Sun, 07 Jul 2002 20:45:47 +0200: > Ok listen im trying to fin all the direcotries that are in a folder, I mean >everyone. But for some > reason this only prints out the first folder and not the sub folders. > > [snipped 18 lines of code] Well, that's a job for File::Find.

Re: Why is \015\012 the same as "\r\n" ? (was: May be off topic)

2002-07-12 Thread Janek Schleicher
Octavian Rasnita wrote at Thu, 11 Jul 2002 17:49:57 +0200: > I try to print the \n character as \015\012 but I don't know why it works and why >\013\010 doesn't > work. > > Isn't CR character ascii 13 and LF character ascii 10? > > What is wrong here? In fact CR is ASCII 13 and LF is ASCII 10

Re: Partially success

2002-07-25 Thread Janek Schleicher
Octavian Rasnita wrote at Thu, 25 Jul 2002 11:21:42 +0200: > The problem is that the file is not deleted if the visitor cancels the file download. > > If the download is interrupted, the script is also interrupted I think, and it can't >delete the > file. > ... > Here is the script: > > #!/per

Re: divide a text file

2002-07-28 Thread Janek Schleicher
Jose Bento wrote at Sun, 28 Jul 2002 01:10:19 +0200: > I have a text file (*.doc) that have a list of articles all of them separated by the >some sequence > of characters (). > > How can I divide this file into several files each one with only one article? What have you tried so far ? Why

Re: What would you recommend?

2002-07-28 Thread Janek Schleicher
Octavian Rasnita wrote at Sat, 27 Jul 2002 13:21:54 +0200: > I've put this question a few months ago, but with no answer. When using the read >function for > reading a file (for printing to the browser - for downloading) how big should be the >buffer size > read at once by the script? > > I'v

Re: regular expression

2002-07-28 Thread Janek Schleicher
Gsulinux wrote at Sat, 27 Jul 2002 13:32:27 +0200: > I wanna check the information typed in the form field whether if it is in date >format or not . > Like : check it if it is in format day/mount/year , in format like ab/cd/ef or >ab/cd/efgh "ab" > must be valid like between 1-31 > "cd" must be

Re: newbie: simple email script

2002-07-28 Thread Janek Schleicher
dpark wrote at Mon, 29 Jul 2002 02:56:57 +0200: > This is my first script, actually part 2 of the first. I triumphantly :) created a >script to > write data from a simple form to a flat-tile database. Now I would like to be able >to send > everyone on the list an email when my client's site

Re: File upload question

2002-07-28 Thread Janek Schleicher
Nate wrote at Sun, 28 Jul 2002 09:51:06 +0200: > i'm writing a website that requires an upload for pictures. I have figured out how >to get the > image, upload it to the correct dirctory and save successfully, but the problem >comes with the > fact that i have to specify the filename. i want to

Re: The size of a folder

2002-08-03 Thread Janek Schleicher
Octavian Rasnita wrote at Sat, 03 Aug 2002 15:43:46 +0200: > Is there a Perl function, or a module that can find out the size of a > directory with all its files from all subdirectories? > I know that I could use the system function to run a command line but I want > to avoid this. I don't know

Re: problems with sendmail within a cgi

2002-08-16 Thread Janek Schleicher
No Longer Exists wrote at Wed, 14 Aug 2002 21:40:41 +0200: > I have this code that redirects just fine, gives me no > errors, yet will NOT send out the e-mail that is > written within the script. IT is running on a AIX > machine. Anyone have any ideas on how to get the > e-mail to run? i have to r

Re: problems with sendmail within a cgi

2002-08-16 Thread Janek Schleicher
T wrote at Fri, 16 Aug 2002 15:27:54 +0200: You change often your name ("No Longer Exists" -> "T") and I'm a little bit afraid to talk too much with schizophrenic person :-( > Janek, > > YAY, that was the problem. So, now it sends it correctly. I am seeing one other >problem now that i > can g

Re: Parsing problem

2002-08-20 Thread Janek Schleicher
Connie Chan wrote at Tue, 20 Aug 2002 09:10:41 +0200: >> C++ program's output looks like this: >> >> A= 20 >> B= 30 >> C= 70 >> AVG= 40 >> MIN= 30 >> MAX= 70 >> TIME= 0.0037 >> >> If I call this in Perl: >> >> #!/usr/bin/perl -w >> my $result = `myapp`; > > replace as : > my @results = `myapp

Re: Parsing problem

2002-08-20 Thread Janek Schleicher
Felix Geerinckx wrote at Tue, 20 Aug 2002 11:29:33 +0200: >> or still shorter: >> my %data = map {chomp; split /= /} `myapp`; > > Shorter yet: > > my %data = map {split /= |\n/} `myapp`; my %data = map {split /=?\s/} `myapp` :-) Well, I still would prefer my first solution, as it is m

Re: Retrieving data from files

2002-08-27 Thread Janek Schleicher
Soheil Shaghaghi wrote at Tue, 27 Aug 2002 18:33:42 +0200: > I am using a program that gets the user information and stores them. The > program stores each user data in a separate file, like userid.tmp I hope, all users you have stored have acknowledged that their data is collected and munged t

Re: Splitting a string

2002-09-06 Thread Janek Schleicher
Octavian Rasnita wrote at Thu, 05 Sep 2002 20:09:58 +0200: > I want to split a string but it is a little too complicated for me. > If it is too complicated, don't give me an answer but just a little hint to > the right direction. > > I have a string like the following example (used to search in

Re: Splitting a string

2002-09-07 Thread Janek Schleicher
Wiggins D'Anconia wrote at Sat, 07 Sep 2002 05:34:55 +0200: > Octavian Rasnita wrote: >> Hi and thank you. It works! >> Could you explain me please in a few words what is this line doing exactly? >> I want to learn. >> >> print join "\n", grep defined, ($string =~ /"(.*?)"|(\w+)/g); >> > [snipp

Re: Splitting a string

2002-09-08 Thread Janek Schleicher
Janek Schleicher wrote at Sat, 07 Sep 2002 10:06:34 +0200: >>> ... >>> print join "\n", grep defined, ($string =~ /"(.*?)"|(\w+)/g); >>> ... > > The regexp matches either "(.*?)" in $1 or (\w+) in $1.

Re: Regular expression

2002-09-08 Thread Janek Schleicher
Octavian Rasnita wrote at Sat, 07 Sep 2002 11:03:39 +0200: > I am trying to match a word boundry or an end of string. > I would like something like: > > /$word[\bX]/ > > where X is the symbol used for end of string. I know that I can use $ but I > don't think I can use it between brackets. > >

Re: renaming uploaded file name

2002-09-09 Thread Janek Schleicher
Naomi Arries wrote at Mon, 09 Sep 2002 15:20:11 +0200: > When uploading a file (say c:\input.txt)to my appache > server upload directory > directly on the c: drive) to the upload directory on the > server then that file gets uploaded to with the name(say > C__input.txt) on the sever(see upload3.

Re: GPL - how does it work

2002-09-19 Thread Janek Schleicher
Mat Harris wrote at Thu, 19 Sep 2002 13:32:44 +0200: > i believe perl itself is released under the GPL? and we have a firewall > script that we compile to hide the source and then sell. we have never had > any comeback from it. perl -v prints at my computer an short declaration of Perl's licens

Re: Parsing an HTML document

2002-09-19 Thread Janek Schleicher
Mmkhajah wrote at Thu, 19 Sep 2002 19:47:53 +0200: > I think this should work: > $content =~ s/\<[^\>]+?\>//g; ^ The question mark isn't necessary as the character class negates the >. Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

Re: Database Normalization ?

2002-09-21 Thread Janek Schleicher
Mmkhajah wrote at Sat, 21 Sep 2002 13:20:14 +0200: > I wonder if it's better to use database normalization solution when dealing with >Flat Files databases ? And your Perl-CGI question is ... ? It's a good question, but I think you better should ask it in a database newsgroup. The only answe

Re: uninitialised value in pattern match

2002-09-24 Thread Janek Schleicher
Francesco Scaglioni wrote at Tue, 24 Sep 2002 13:40:40 +0200: > I have one problem ( actually I'm sure I have many but haven't > realised it yet ) that I'm stuck on. > >the following line ( and several others like it ) produce the >following error : > >( my $mollusc ) = ( param( 'm

Re: uninitialised value in pattern match

2002-09-25 Thread Janek Schleicher
Francesco Scaglioni wrote at Wed, 25 Sep 2002 15:45:22 +0200: > Typo in the copy not the original -- I think I misstated my question > -- the error message in the log only occurs when there is no mollusc > parameter ( sometimes there is sometimes there isn't ). How can I > check for the existanc

Re: perl

2002-09-26 Thread Janek Schleicher
Weibel Daniel wrote at Thu, 26 Sep 2002 09:55:01 +0200: > I'm trying to get a random line from a text file and than delete the file. > I came up with this and it works, however the line which was cut/past adds > without any reason a backspace/space on it. It doesn't write it all on one > line.

Re: css attributes in CGI

2002-09-27 Thread Janek Schleicher
Jimmy George wrote at Fri, 27 Sep 2002 00:36:42 +0200: > When we use commands such as > > $q->p("some line of text"); > > when doing prints, is there any way of giving the output attributes such > as we can with css descriptors? e.g. $q->p({-style => 'color: red; font-size: 24pt'}, "som

Re: css attributes in CGI - more questions

2002-09-29 Thread Janek Schleicher
Jimmy George wrote at Sun, 29 Sep 2002 10:38:16 +0200: > LIMITED SUPPORT FOR CASCADING STYLE SHEETS > from > perldoc CGI > > where is that? I am a beginner. On a Mac. With a home page serviced by a > remote ISP. No Linux contact. It's a subsection in the perl documentation of the CGI module. p

Re: Has Perl extra memory!?

2002-09-30 Thread Janek Schleicher
Damien Delhomme wrote at Mon, 30 Sep 2002 18:48:01 +0200: > The only modules I use are : > > use CGI; > use DBI; > use HTML::Template; > use Data::Dumper; > > (I am not the original programmer, I'm trying to make it work!) > > My script is called by a file .xml with : > > I don't know much

Re: Has Perl extra memory!?

2002-10-01 Thread Janek Schleicher
Damien Delhomme wrote at Mon, 30 Sep 2002 23:53:20 +0200: >> > My script is called by a file .xml with : >> > >> > >> >> I don't know much about this xml feature, >> but I could imagine that it works like a calling from the command line. >> >> In this context, the CGI module will (perhaps) try t

Re: Number format control

2003-01-29 Thread Janek Schleicher
On Wed, 29 Jan 2003 14:02:47 +, Jattie Van Der Linde wrote: > c syntax equivalent: printf ("%3.0f",Value); /*if value = 123.456 result would be >123*/ > > What is the equivalent perl command ... printf "%3.0f", $Value; Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

Re: Printing arrays without empty variables

2003-02-05 Thread Janek Schleicher
On Tue, 04 Feb 2003 17:37:35 -0500, Jan Cohen wrote: > I'm just learning perl and would like to know how to print the contents of > an array, without printing any of the elements in the array that might be > empty. > [...] perldoc -f grep Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PRO

Re: an infinite loop

2003-02-05 Thread Janek Schleicher
On Tue, 04 Feb 2003 22:33:13 +0200, Shahar Evron wrote: > this peace of code seems to generate an infinite loop, and i have no > clue why. this may very well be for a very silly reason, but i'm clueless... > >> while (1) { >> if ($ntries >= 4) { >> print ER

Re: email adress eq email adress?

2003-03-03 Thread Janek Schleicher
On Sun, 02 Mar 2003 06:20:23 +0100, Ian V=?Iso-8859-1?B?5a==?=Nnman wrote: > Removing the "" around the variables solved the problem... There are additional informations about this problem also in the Perl FAQ: perldoc -q "What's wrong with always quoting \"$vars\"?" > But s/\@/\\\@/; also works

Re: checking if its a real number

2003-03-04 Thread Janek Schleicher
On Wed, 26 Feb 2003 16:30:56 -0800, T. Murlidharan Nair wrote: > Is there a quick and easy way to check this. I was trying using a reg exp > if(/^[-0-9][\.0-9]*/) { > do something > } In CPAN there's also a module Regexp::Common that has a lot of commonly requested regexps. E.g. also $RE{num}{re

Re: checking if its a real number

2003-03-04 Thread Janek Schleicher
On Wed, 26 Feb 2003 19:47:35 -0500, Casey West wrote: > Here's a nice trick. Use the int() function. It's documented in > perlfunc, a short to the documentation is 'perldoc -f int'. > > When passed a string, int() will return 0. When passed a number, it > will return the integer version of tha