20 Topics
This is a routine task best done with two regexp's when using perl. | |
A bare-bones code snippet to remove duplicate lines from a file. There are a number of ways to accomplish this task but this is a fast and dependable method using perls inplace editor and a simple hash to get the job done. This probably should not be used for really … | |
This is a bare-bones search and replace script that uses perls in-place editor and the File::Find module to get the job done quickly. It will search in all sub directories of the start directory and find and replace the text you specify in the type of file you specify. Keep … | |
Code snippet to generate random passwords. Avoids using confusing characters such as lower case L (l) and the number one (1), the letter 'O' and the number zero. Upper-case alpha characters could be added to the character set if mixed-case passwords are desired. | |
This code snippet will produce strings of numbers (1 thru 49) with no repeated numbers in the same string and no duplicated string of numbers in the list of strings. To change the range of numbers the script generates change 49 in the code to your requirements. Please feel free … | |
Given the date in mm-dd-yyyy (or M-D-YYYY) format (or any combination of that format) you can find out what day of the week that was on or is on or will be on, within the limitations of the system the script resides on. This snippet uses only core functions and … | |
Convert 1000000 into 1,000,000 using a perl regexp. | |
Use the List::Util module. I believe List::Util is a core module starting with perl 5.8. For older versions of perl you may need to install the module. See the module documentation for more details: [URL="http://perldoc.perl.org/List/Util.html"]List::Util[/URL] | |
I've seen this question (or similar) asked many times on forums: I have a variable in a file (text) and want to expand it. For example, I have this line in a text file: Mary had a little $lamb and I want to be able to expand $lamb but text … | |
"How can I find all the permutations of a list (or a word)"? I have seen this question asked a number of times on forums. There is a module that makes this task very easy: List::Permutor. It is not a core module so you may need to install it. See … | |
You will need to install the Email::Valid module if it's not already installed. See the module documentation for further details. [URL="http://search.cpan.org/~rjbs/Email-Valid-0.176/lib/Email/Valid.pm"]Email::Valid[/URL] | |
The [URL="http://perldoc.perl.org/File/Basename.html"]File::Basename[/URL] module is used to parse file paths into directory, filename and suffix (or file extension). My simple example shows how to get just the file extensions. | |
Daniweb.... please remove all the stupid comments posted by sultan6928 in this code snippet: [url]http://www.daniweb.com/code/snippet631.html[/url] Thanks | |
When I click the link to go to the second page of code snippets in the perl category, I get an error message instead of seeing more code snippets: "No code snippets available with the criteria specified. " | |
I had a need to read one of the code snippets I posted a while back (perl) and noticed the syntax highlighter has screwed up the code I posted by adding an extra backslash making the snippet no good. I thought I would just try and edit the snippet but … | |
I assume if it is happening to me it must be happening to others. I am using FireFox 2 on dial up (56k). See attachment. | |
The amount, size, placement, and etc, of advertisements on the pages is getting a bit obnoxious (one ad that scrolled across the screen was very obnoxious). I understand the need and the desire for advertising, but the pages are starting to look like billboards with some content thrown in instead … | |
in the code snippets perl syntax highlighter, this regexp: [CODE]$string =~ s/^\s+//;[/CODE] the first 's' after the '=~' operator is correctly linked to the perldoc page concerning the 's' function, the second 's' however is also linked to the same page, which is not correct since it is the meta … | |
the Perl syntax highlighter is mangling some perl code, for example, this line: [CODE]my(undef, undef, $ftype) = fileparse($file,qr{\..*});[/CODE] using the perl syntax highlighter (which I guess does not work in this forum) the backslash in [B]qr{\..*}[/B] is removed, and becomes [B]qr{..*}[/B] which is no longer the correct code for the … | |
Just a short intro, I'll be posting in the perl forum 99.9999% of the time so don't expect to see too much of me, but I wanted to say hi and compliment ya'll on what looks like a good forum that is growing and I hope continues to grow. Kevin |
The End.