Re: Trying to block out BGCOLOR
Just so everyone knows, it was for a print friendly part of a CMS-type script. With all your help, it was solved, with a regex. It wasn't just for the body tag, It is for EVERY tag, and I blocked the BGCOLOR, BACKGROUND, STYLE, CLASS, ID, COLOR, and more attributes to totally make the page both dull and print friendly. My problem was with my Regex, which was: $blah =~ s/ bgcolor=(?)(.*?)(?)//gi Shortly after posting, I solved it myself with $blah =~ s/ bgcolor=(?)(.*?)( |)/$4/gi; I doubt that would have held up. My new one thanks to drieux is: $blah =~ s/\s*bgcolor=(?)([^\s]+)(?)//gi ; Thank you for your help everyone. William Gunther
Re: simple query
In a message dated 3/20/2003 12:35:02 AM Eastern Standard Time, [EMAIL PROTECTED] writes: Hi Can anyone tell me what does $. in perl mean ? And also anyplace I will get references about these in quick time ie. a handbook type ? It is an alternitive for $INPUT_LINE_NUMBER. All these are in a handy book called Perl 5 Pocket Reference by O'Reilly.
Re: Trying to block out BGCOLOR
I'm saying it could be bgcolor=COLOR or bgcolor=COLOR
Trying to block out BGCOLOR
I'm making something, and need to block out BGCOLOR attribute. The problem is, the BGCOLOR could be with or without quotation marks. This is the code I used: $article =~ s/ bgcolor=(?)(.*?)(?)//gi It doesn't work to my liking, and was hoping someone else had a better solution. William
Re: searching a string
$string = the\n\tlucky\n\t\tcoin; if ($string =~ m/^(\s)*the(\s)*lucky(\s)*coin(\s)*$/) { print Yup; }
Re: Good Perl cgi book?
Elizabeth Castro's Perl and CGI for the WWW: Visual Quickstart Guide. In a message dated 3/18/2003 8:45:04 AM Eastern Standard Time, [EMAIL PROTECTED] writes: What is the best book for a beginner to get started with on Perl and CGI?
Re: Random letters
Someone may have a better solution, but here is mine: use strict; my (@array, $y, $x, $rnd); until ($y == 10) { push(@array, $y); $y++;} push(@array, qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)); #Make the @array $x = 50;#numer of numbers taken while ($x 0) { $rnd = int((rand) * 35) + 1; print $array[$rnd]; $x--; }
Re: Learning Perl
In a message dated 2/28/2003 5:28:56 AM Eastern Standard Time, [EMAIL PROTECTED] writes: I have started learning perl language and to this effort I have bought the book programming perl from O\'Reilly .Can anyone tell me whether this one is okay and how to exactly go forward learning perl.What things to be learnt first etc. I think Programming Perl is good for learning. There is a book also called Learning Perl from O'Reilly, but really I don't feel there is a suitable enough reason to pay a lot of money for it, especially since you have Programing Perl already. Programming Perl is very detailed, and reading that book should teach you a lot of perl. Talking to other Perl Programmers is important too. The most important thing is progressive practice. As this is a CGI mailing list, I thought I'd mention that the book I began learning off of was Perl and CGI for the World Wide Web: Visual Quickstart Guide by Castro. I thought is was good, it taught me the basics. I was just some web designer that wanted to learn some Perl. After than one I read Programming Perl, I did not buy it though, I went to the library. William
Re: uninitialised variable error
In a message dated 1/24/2003 1:42:42 AM Eastern Standard Time, [EMAIL PROTECTED] writes: #!/usr/bin/perl -w # # emails comments from the site to my address # use strict; use CGI; # # my $q = new CGI; my $name = $q-param( name ); my $email = $q-param( email ); my $comments = $q-param( comments ); my $info = ($name\n$email\n$comments\n); Works for me. Make sure you have a value for $name, $email, and $comments. Run a querry string with it or something, because if there is no param('name') then $name is initialized, as in it's 0, right?
Re: Help in running cgi script to append passwd file, shadow and group
In a message dated 1/24/2003 2:32:26 AM Eastern Standard Time, [EMAIL PROTECTED] writes: my problem is, the cgi can't append the password, shadow and group file. How can I make my script to work? I don't have any idea now if its possible to make the script work I won't act like I know the Linux system. Appending a file though: open(FILE, path/to/file);
Re: Installing Time::HiRes module
In a message dated 1/21/2003 12:31:17 AM Eastern Standard Time, [EMAIL PROTECTED] writes: I've tried this method, but it doesn't work for Perl 5.8 but only for Perl 5.6.1 That is because of the build of ActiveState. Perl 5.6.1 is a 6xx (right now 633 I think) and Perl 8.0 is on a 8xx A HREF=http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/;ppm.activestate.com - /PPMPackages/zips/8xx-builds-only/Windows//A Download from that link, and that should work.
Re: Date
In a message dated 1/21/2003 12:15:36 AM Eastern Standard Time, [EMAIL PROTECTED] writes: I am writing a cgi script to run as a cron job. when it runs i need the date of 'one year ago today' in the format '-MM-DD' to be stored in a variable to be used later in the script. I am about as dumb as wet dirt when it comes to cgi. Can someone please help me with this? In a message dated 1/21/2003 12:15:36 AM Eastern Standard Time, [EMAIL PROTECTED] writes: I am writing a cgi script to run as a cron job. when it runs i need the date of 'one year ago today' in the format '-MM-DD' to be stored in a variable to be used later in the script. I am about as dumb as wet dirt when it comes to cgi. Can someone please help me with this? @time = localtime; $time = $time[5] + 1899 . - . $time[3] . - . ($time[4] + 1); print $time;
Re: splitting sub functions into multiple. files
In a message dated 1/21/2003 2:47:44 PM Eastern Standard Time, [EMAIL PROTECTED] writes: How do I split the big file up into smaller bits - ex. One sub function per file? (How too do it isn't a problem) but how do I tell the main function how to find the files where the sub function is located? Next question should I cal the files xxx.pl or xxx.inc or xxx.? And Finally should each file begin with the #!usr/bin/perl or isn't that necessary?? I hope that someone can give me an answer - I tried have tried to find the answer on perl.org / perdoc.org but without any success. First off, it's pretty easy. Most people name it .pl, for Perl Library, or .lib, but it doesn't matter. You don't need the path to perl, all you need is this line at the bottom of the file: 1; This returns a true value. This will open the subroutines from your program: require '/path/to/file.pl'; You can do a complete path, or a relative path will work. Now, you can call the subroutines that were in the file. perldoc -f require should tell you more.
Re: Installing Time::HiRes module
In a message dated 1/20/2003 12:18:33 PM Eastern Standard Time, [EMAIL PROTECTED] writes: I am trying to install Time::HiRes module and I am getting the following error: C:\ppm PPM interactive shell (2.1.6) - type 'help' for available commands. PPM install Time-HiRes Install package 'Time-HiRes?' (y/N): y Installing package 'Time-HiRes'... Error installing package 'Time-HiRes': Could not locate a PPD file for package Time-HiRes PPM Where should the PPD file be? How do I point to it? Worked on my ppm. Make sure you have your repositories set up correctly. If it doesn't work download: http://ppm.activestate.com/PPMPackages/zips/6xx-builds-only/Time-HiRes.zip extract, cd to it in a command prompt and run: ppm install Time-HiRes.ppd But, like I said, you should be able to do it from active state's repository.
Re: Escape Characters
In a message dated 1/18/2003 6:43:00 PM Eastern Standard Time, [EMAIL PROTECTED] writes: I was looking for something similar to the PHP addslashes(). Or maybe replace, like replace(strAdd, @, \@). You could just say $email = '[EMAIL PROTECTED]'; The '..' is without interpolation, and .. is with interpolation. There is more then one way to do it says Larry Wall.
Re: Naming a variable from value of a scalar.
In a message dated 1/17/2003 6:04:41 PM Eastern Standard Time, [EMAIL PROTECTED] writes: Is it possible to name a variable as the numeric value of a scalar? Well, all scalar variables you create must start with a letter. But, if you're talking about something like this: $var = hello; ${$var} = 1; print $hello; You can do it.
Re: Graphs on the fly
If your on a Unix system, you can install the GD modules very simply like you would any (check out the help files on cpan.org, and of GD itself. (perldoc -q install will work too)) The installation instructions I gave was for GD on a Widows ActivePerl system, because someone asked.
Re: Graphs on the fly
In a message dated 1/14/2003 4:33:13 PM Eastern Standard Time, [EMAIL PROTECTED] writes: Can anybody tell me how to install GD for Active State Perl? Thanks a lot. Go: A HREF=http://www.activestate.com/PPMPackages/zips/6xx-builds-only/GDTextUtil.zip;Here/A and download GD.zip. Unzip, and chdir to the directory you downloaded to. Then do ppm install GD.ppd Repeat with GDGraph.
Re: using an AND operator
In a message dated 1/11/2003 9:43:32 AM Eastern Standard Time, [EMAIL PROTECTED] writes: if ($SRF=1 and $SRL=1) {printYES;) You got the and right, but the conditional wrong. 2 equal signs for conditionals. So your example: $SRF = 1; $SRL = 1; if ($SRF==1 and $SRL==1) {printYES;} #True or is $SRF = 1; $SRL = 1; if ($SRF==1 or $SRL==1) {printYES;} #True xor (both not true, 1 is) $SRF = 1; $SRL = 1; if ($SRF==1 xor $SRL==1) {printYES;} #False You can also use | and for logical and bitwise and or or . A HREF=http://www.cs.appstate.edu/~can/classes/3481/IA/3481PerlTABLES.html;(The CS-3481 Perl Tables/A)
Re: add new piece of html code in perl not success:internal server error
Post that part of your code so people can help you.
Re: Strict and variables
In a message dated 11/26/2002 5:08:23 PM Eastern Standard Time, [EMAIL PROTECTED] writes: Using my $FORM{'changeaddress'} doesnt work It's a hash. Use my %FORM;
Re: Convert IP address
In a message dated 11/11/2002 9:16:10 AM Eastern Standard Time, [EMAIL PROTECTED] writes: was wondering if there is a module or someone may know of a quick means of convering a IP address to a host/domain address. $ip = $ENV{'REMOTE_ADDR'}; @digits = split (/\./, $ip); $address = pack (C4, @digits); $host = gethostbyaddr ($address, 2);
Re: Parsing an HTML document
In a message dated 9/19/2002 11:54:45 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: I want to parse an HTML document to get out the simple text from it. I've tried with HTML::Parser, but with no success. The POD documentation is not very good and I haven't seen any assignment as $text = ... to see how to get the text. use HTML::Parse; use HTML::FormatText; $text = HTML::FormatText-new-format(parse_html($html_text)); use lib if you don't have HTML::FormatText installed. $text =~ s/[^]*//gs won't work on something like img src=source alt=alt height=height width=width -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Fw: output pushing
Worked for me, quite well except for: print HTTP/1.0 200 OK\n; Which errored. If you get rid of it, it works still. If it doesn't work for you, it shouldn't be a browser error but a server one, I guess. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: programmers place
ScriptLance.com is good.