Re: Perl script help
From: Greg Barniskis <[EMAIL PROTECTED]> To: Jack Stone <[EMAIL PROTECTED]> CC: freebsd-questions@freebsd.org Subject: Re: Perl script help Date: Wed, 25 Jan 2006 13:29:39 -0600 Jack Stone wrote: I'm using an old (2001) canned perl script to manage questions to my tech site. It is of big help since it can answer common questions from templates and a real time saver. First, this isn't really a FreeBSD question, so you may certainly have better luck getting it answered in a Perl-oriented forum (or best, the help forum or the original author of the script in question). [snip] Is there any way to insert the same type of tests on those original copies in the storage as "*.ftf" files and just delete them so they aren't there when the question manager program is loaded?? If I were you I would be looking at the Perl code just before those lines that you quoted in your original message. Inspect the content of $FORM{message} earlier in the process and use Perl pattern matching to see if it contains taboo content. Something like if ($FORM{message} =~ /taboophrase/) { msgisjunk; } First, thanks for the tip as it works using "exit;" which might be enough, but would rather do a redirect to a page just in case one of the good guys trips over it in their questions. So, I'll try to figure out how to do that without further burden to you or this fine, helpful and usually friendly list. With regard to your other remarks about learning perl and OT, there are many questions (like shell scripts here today) that don't quite fit. Of course, perl is part of the base OS, so it's not far off for the many script gurus I know that are here. I've been a member of this list for several years and have answered dozens if not several 100 questions of all kinds that I do know about. Since I probably don't ask more than 3 or 4 question a year, I should be entitled to ask them vs my contributions. I enjoy helping when I can OT or not. IMHO, this is one of the best lists to obtain help about scripts when one just doen's have to time to learn a whole scripting language. Going to a script list isn't very helpful either. I'm a "Jack of all trades, but no master of perl." Again, thanks for the help -- but, not the lecture though as it was the obvious thing to do IF one really had time or the right skill/talent to learn a language. Regards, Jack _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: perl script help
On Fri, 16 Apr 2004, Shaun Friedle wrote: > #!/usr/bin/perl > $timezone=`date +\%z`;#Gets the offset in $timezone > $timezone =~ s/(\+[0-9][0-9])/$1:/; #Replaces ±NN with ±NN: > print $timezone; #Prints $timezone The regex should allow either a plus or a minus as the first character: s/([+-][0-9]{2})/$1:/ I like Perl a lot, and use it often, but it seems a bit much for this. If there were easy shell substring operations... Anyway, shell-only: date +%z | sed 's/.../&:/' # insert colon after first three chars -Warren Block * Rapid City, South Dakota USA ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: perl script help
On Fri, 2004-04-16 at 17:05, JJB wrote: > I know nothing about writing perl scripts. > > Can somebody show me how to add the : in the output > of the date command in the simple following script? Try this: #!/usr/bin/perl $timezone=`date +\%z`; #Gets the offset in $timezone $timezone =~ s/(\+[0-9][0-9])/$1:/; #Replaces ±NN with ±NN: print $timezone;#Prints $timezone -- Shaun Friedle [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: perl script help
Not that i am very good in perl, In KSH scripting it's like this: %H:%M for a 00:00 output instead of Perhaps that will help you:-) (Oh the command date +%H:%M) Cheers Well that does not work (FYI) Cheers (perhaps Matthew's comments on this are better ;-) ) -- Kind regards, Remko Lodder Elvandar.org/DSINet.org www.mostly-harmless.nl A Dutch community for helping newcomers on the hackerscene ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: perl script help
JJB wrote: I need $timezone to hold the time zone in this format -00:00 The command date +%z will give it as - I know nothing about writing perl scripts. Can somebody show me how to add the : in the output of the date command in the simple following script? The cat statement is just so I can see results are correct. #!/usr/bin/perl $timezone=date +%z; cat $timezone Not that i am very good in perl, In KSH scripting it's like this: %H:%M for a 00:00 output instead of Perhaps that will help you:-) (Oh the command date +%H:%M) Cheers ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" -- Kind regards, Remko Lodder Elvandar.org/DSINet.org www.mostly-harmless.nl A Dutch community for helping newcomers on the hackerscene ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"