Posts
 
Reputation
Joined
Last Seen
Ranked #180
Strength to Increase Rep
+10
Strength to Decrease Rep
-2
92% Quality Score
Upvotes Received
41
Posts with Upvotes
37
Upvoting Members
29
Downvotes Received
4
Posts with Downvotes
3
Downvoting Members
3
35 Commented Posts
~106.91K People Reached
Favorite Tags

460 Posted Topics

Member Avatar for pjrey

I suggest you look into existing programs on script archives such as [url]www.hotscripts.com[/url] and see if you can find something that does what you want or comes close to doing it.

Member Avatar for clickmind
-1
1K
Member Avatar for Narayanank

as far as I know there should be no quotes on the shebang line: #!c:\xampp\perl\bin\perl.exe but you're better off using forward slashes, which Windows fully supports: #!c:/xampp/perl/bin/perl.exe backslashes in perl code create escape sequences, not on the shebang line which is a special line in a perl program, but its …

Member Avatar for srija.divakar
0
457
Member Avatar for KevinADC
Member Avatar for typomaniac101

Using "strict" is important , especially for new perl coders, but it is not necessary to use it. But you will see that 99% of all perl scripts use "strict" and most use "warnings". The -T switch (not -t) is also important for a CGI script. It is there to …

Member Avatar for semontuffel
0
164
Member Avatar for Newten
Member Avatar for srvinu

Use a hash to compare the lines. [CODE]use strict; use warnings; my $f1 = 'E:\upload\new\2.txt'; my $f2 = 'E:\upload\new\a.txt'; my $outfile = 'E:\upload\new\1.txt'; my %results = (); open FILE1, "$f1" or die "Could not open file: $! \n"; while(my $line = <FILE1>){ $results{$line}=1; } close(FILE1); open FILE2, "$f2" or die …

Member Avatar for cod3r
0
679
Member Avatar for grr

The character class you have will match all of the characters in the list of characters you posted. Is there a problem?

Member Avatar for YoussefUSF
0
200
Member Avatar for chandrag

save the data to a file with an html extension and then up it up in a browser. Or access the url from the internet using a browers.

Member Avatar for creativesuri
0
710
Member Avatar for brax4444
Member Avatar for voidyman
0
471
Member Avatar for bhavna_816

alternatives that do the same thing: print directly from file: [CODE]print "Content-type: text/html\n\n"; open (HTML, "<../path/to/your/file.htm"); print <HTML>; close (HTML);[/CODE] use a scalar instead of an array (slurp mode) [CODE]print "Content-type: text/html\n\n"; open (HTML, "<../path/to/your/file.htm"); my $html = do {local $/; <HTML>}; close (HTML); print $html;[/CODE]

Member Avatar for hsincredible
0
397
Member Avatar for orwell84

Your code is quite close to getting it right, here is a way to do this type of looping guessing game: [code] use strict; use warnings; my $thinkingof = int(rand 10)+1; while (1) { print "Pick a number 1 to 10\n"; my $guess = <STDIN>; chomp $guess; if ($guess > …

Member Avatar for mdawg252
0
838
Member Avatar for FoX_

It would be simpler to use perls inplace editor for this type of task; [CODE]sub edit { my $file = 'path/to/file.txt'; print "Enter the person's name and surname which you'll update the record: "; chomp($dest = <STDIN>); my ($name, $surname) = split(/\s+/,$dest); print "Enter new phone number: "; chomp($newNum = …

Member Avatar for boshu
0
221
Member Avatar for KevinADC

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 …

Member Avatar for sensamurai
1
1K
Member Avatar for NevadaSam

[QUOTE=Comatose]Look up the substitution operator. s//. You can replace the data like so: [CODE] $myvar = "hello|world|yes!"; $myvar =~ s/|/\t/gi; print "$myvar"; [/CODE][/QUOTE] I'm wondering if you or the OP ran the code you suggested, I think you will find the results not what is expected if the code is …

Member Avatar for d5e5
0
384
Member Avatar for kahaj

You are running a CGI script. It is expecting data from a CGI form: $name = param ('Salesperson'); $sales = param ('Sales'); $rate = param ('Rate'); the above scalars will have no values (they are uninitialized). Why are you running a CGI script from the command line? That is OK …

Member Avatar for d5e5
0
356
Member Avatar for Akase

Akase... You insult everyone helping on this forum by posting your plagarized code and making it appear as if you wrote it. [url]http://www.programmersheaven.com/mb/perl/372885/392147/re-analysing-text-files-to-obtain-statistics-on-their-content/?S=B20000#392147[/url]

Member Avatar for penfold58
0
483
Member Avatar for thego!team

two ways to go about it: [CODE] chdir("path/to/dir") or die "$!"; opendir (DIR, ".") or die "$!"; my @files = grep {/students_.*?\.html/} readdir DIR; close DIR; { local @ARGV = @files; while(<>){ #each file will be read line by line here } }[/CODE] [CODE]opendir (DIR, "path/to/dir") or die "$!"; my …

Member Avatar for raul15791
0
504
Member Avatar for ramagiri

I didn't get the impression it was homework/schoolwork but I have no idea how to answer such a question: [QUOTE]what are all the scenarios under which perl is used for software testing[/QUOTE] I don't even know what "testing software" means? Testing it for what?

Member Avatar for testuser_forum
0
97
Member Avatar for kishore5001

[QUOTE=lordspace;334645]It seems __END__ is a "synonym" of __DATA__[/QUOTE] [url]http://perldoc.perl.org/perldata.html[/url] [QUOTE]For compatibility with older scripts written before __DATA__ was introduced, __END__ behaves like __DATA__ in the toplevel script (but not in files loaded with require or do) and leaves the remaining contents of the file accessible via main::DATA .[/QUOTE]

Member Avatar for afbach
0
2K
Member Avatar for bradleykirby

/^\D\w{3,7}\d+/; the above means: ^\D starts with one non-digit character \w{3,7} followed by 3 to 7 word characters, same as a-zA-Z0-9_ \d+ followed by one or more digits what you probably want is is two regexps: /\d/ has at least one digit /^[a-zA-Z][a-zA-Z0-9]{3,7}/;

Member Avatar for peter_budo
0
350
Member Avatar for pjrey

Sorry, I have read your question three times and I can't understand what you want to do.

Member Avatar for pjrey
0
269
Member Avatar for chandrag

You have to use the -e switch to execute code from the command line: perl -e "print \"Hello World\";"

Member Avatar for dangidipu
0
932
Member Avatar for Davo1977
Member Avatar for d5e5
-1
242
Member Avatar for KevinADC

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 …

Member Avatar for roswell1329
0
249
Member Avatar for samaru

I think hes really checking to see how many people will respond to a very old thread. So far 3, counting me. ;) Do you need to be a programmer to be a mathmatician? Or does the inverse logic not apply?

Member Avatar for happygeek
0
2K
Member Avatar for KevinADC

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.

Member Avatar for Prakash_8111
-1
432
Member Avatar for Prakash_8111

[QUOTE=Prakash_8111;987870]Hi Guys, Can any one suggest to generate a random number of eight digit. All suggestions are welcomed :)[/QUOTE] [url]http://www.daniweb.com/code/snippet216771.html[/url] A search engine would also find many examples of code to do what you are asking.

Member Avatar for KevinADC
-1
112
Member Avatar for KevinADC

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 …

Member Avatar for KevinADC
0
651
Member Avatar for Kelicula

You should put all the code in the same post. In your function you should use if/elsif/else instead of if/if/elsif.

Member Avatar for Kelicula
0
219
Member Avatar for Kelicula

Image-Size has dependencies, so adding it via the lib pragma may not work unless the depenedencies are also added. It is a good way though to get image dimensions.

Member Avatar for Kelicula
0
167
Member Avatar for MattEvans
Member Avatar for KevinADC

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 …

1
1K
Member Avatar for Mushy-pea

Looks like an error/typo in this line: unless (flag1 == 0) {die("Cannot open visitor_stat.txt");} missing the '$' before flag1, should be: unless ([B]$[/B]flag1 == 0) {die("Cannot open visitor_stat.txt");}

Member Avatar for Mushy-pea
0
197
Member Avatar for KevinADC
Member Avatar for KevinADC

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]

0
167
Member Avatar for KevinADC

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 …

0
278
Member Avatar for KevinADC

"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 …

0
174
Member Avatar for KevinADC

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]

0
294
Member Avatar for KevinADC

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.

0
884
Member Avatar for MikeDexter

Mike, You have several very good replies on perlguru but here is your code rewritten to work: [code] [COLOR="Green"][I]# first open file for reading only[/I][/COLOR] open (INFILE, $ARGV[0]) or die "Error $ARGV[0]: $!\n"; @slurp = <INFILE>; close(INFILE); [COLOR="Green"][I]#now open file for overwriting[/I][/COLOR] open (OUTFILE, [COLOR="Red"]">"[/COLOR], $ARGV[0]) or die "Error $ARGV[0]: …

Member Avatar for MikeDexter
-1
161
Member Avatar for DemonixXV2

You should just append a date to the end of the log file then you don't need to rename all the other files every time the script runs.

Member Avatar for DemonixXV2
-1
160
Member Avatar for sanushks

Check the Windows server 2003 error logs. Hopefully there is something in the log that can help. Before you ask how, search google: [url]http://www.google.com/search?q=Windows+server+2003+error+logs[/url]

Member Avatar for KevinADC
-1
245
Member Avatar for Prakash_8111

Calling another perl script in a loop should not be difficult but the last part of your question makes no sense to me. [QUOTE]I want the second calling of the script shouldn't depend on the first calling.... all should run independently............[/QUOTE]

Member Avatar for onaclov2000
-1
140
Member Avatar for LSU_223

Do the groups of lines with numbers break at the lines with text? In other words, do you only sort the numbers up to "test" as a group, and then sort the next set of lines with numbers until the next line with "test" or does the sorting of the …

Member Avatar for KevinADC
-1
126
Member Avatar for JayT

[QUOTE=bildja;939180]i'm sure 'file' is absolutely valid)[/QUOTE] cool, for the last 2 and a half years I've been wondering about that..... :-/

Member Avatar for bildja
0
216
Member Avatar for derekn

use sprintf to round off your numbers. [CODE=perl]my $t = 92.38495; $t = sprintf ("%.0f", $t); print $t;[/CODE]

Member Avatar for KevinADC
0
227
Member Avatar for perlfan

It aborts because you can't have nested quantifiers. Your expectation of what the "g" modifier does is also wrong. Here is an excerpt from perlretut: Global matching The final two modifiers //g and //c concern multiple matches. The modifier //g stands for global matching and allows the matching operator to …

Member Avatar for perlfan
0
136
Member Avatar for jen140

Normally in perl you don't worry about memory management. But instead of undef you can assign the variable an empty list/string and see if that helps free up memory. $var = ''; @var = (); %var = ();

Member Avatar for lordspace
0
96
Member Avatar for perlfan
Member Avatar for orwell84

hashes are not randomly ordered lists, they are lists that don't have any guaranteed ordered, but they should always be the same order on the same computer. So that bug report appears to be erroneous because the reporter did not seem to understand that hashes are not randomly ordered. If …

Member Avatar for KevinADC
0
461

The End.