Search Results

Showing results 1 to 40 of 898
Search took 0.05 seconds.
Search: Posts Made By: KevinADC
Forum: Perl Sep 18th, 2009
Replies: 3
Views: 512
Posted By KevinADC
http://www.daniweb.com/code/snippet216771.html

A search engine would also find many examples of code to do what you are asking.
Forum: Perl Sep 3rd, 2009
Replies: 8
Views: 619
Posted By KevinADC
Mike,

Like I said, don't bother with the + file open operator, use Tie::File or perls inplace editor. And why are you using "while (<@slurp>)" instead of "for(@slurp)". Its a little bit...
Forum: Perl Sep 1st, 2009
Replies: 8
Views: 619
Posted By KevinADC
# Rewrite of kevin code, why don't this work?
open (INFILE, '<', $ARGV[0]) or die "Error writing to $ARGV[0]: $!\n";
@slurp = <INFILE>;
for ( @slurp )
{
s#<(/?)H1>#<$1H2>#g;
print...
Forum: Perl Sep 1st, 2009
Replies: 8
Views: 619
Posted By KevinADC
Your code does not work to edit the file because as was explained to you on perlguru you have opened the file for reading only. That is why I open it a second time as explained in the comments in the...
Forum: Perl Sep 1st, 2009
Replies: 8
Views: 619
Posted By KevinADC
Mike,

You have several very good replies on perlguru but here is your code rewritten to work:


# first open file for reading only
open (INFILE, $ARGV[0]) or die "Error $ARGV[0]: $!\n";...
Forum: Perl Aug 24th, 2009
Replies: 4
Views: 524
Posted By KevinADC
You already got a script on another forum so I will drop out of this thread
Forum: Perl Aug 23rd, 2009
Replies: 4
Views: 524
Posted By KevinADC
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.
Forum: Perl Aug 22nd, 2009
Replies: 1
Views: 493
Posted By KevinADC
Check the Windows server 2003 error logs. Hopefully there is something in the log that can help.

Before you ask how, search google:
...
Forum: Perl Aug 17th, 2009
Replies: 1
Views: 478
Posted By KevinADC
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...
Forum: Perl Aug 14th, 2009
Replies: 5
Views: 973
Posted By KevinADC
I guess you didn't read what exec() does.



http://perldoc.perl.org/functions/exec.html

As they say on forums: Read the manual

If you want to run multiple instances of a perl program I...
Forum: Perl Aug 14th, 2009
Replies: 5
Views: 973
Posted By KevinADC
Calling another perl script in a loop should not be difficult but the last part of your question makes no sense to me.
Forum: Perl Aug 13th, 2009
Replies: 8
Views: 1,496
Posted By KevinADC
Forum: Perl Aug 13th, 2009
Replies: 8
Views: 1,496
Posted By KevinADC
considering the thread is almost a year old.......
Forum: Perl Aug 4th, 2009
Replies: 4
Views: 7,452
Posted By KevinADC
cool, for the last 2 and a half years I've been wondering about that..... :-/
Forum: Perl Aug 2nd, 2009
Replies: 1
Views: 463
Posted By KevinADC
use sprintf to round off your numbers.

my $t = 92.38495;
$t = sprintf ("%.0f", $t);
print $t;
Forum: Perl Aug 1st, 2009
Replies: 2
Views: 403
Posted By KevinADC
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...
Forum: Perl Jul 31st, 2009
Replies: 4
Views: 493
Posted By KevinADC
You need parentheses for back references to capture patterns they find.


if (/($pattern)/) {
Forum: Perl Jul 31st, 2009
Replies: 1
Views: 452
Posted By KevinADC
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...
Forum: Perl Jul 31st, 2009
Replies: 5
Views: 420
Posted By KevinADC
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...
Forum: Perl Jul 31st, 2009
Replies: 4
Views: 493
Posted By KevinADC
What are you entering into $pattern?
Forum: Perl Jul 28th, 2009
Replies: 2
Views: 523
Posted By KevinADC
I assume you are shelling out because you don't know who to write it all in perl. Here is one way:


#!/usr/bin/perl -w
#for folders 41..60
open (my $OUT, ">>", "path/to/output1") or die "$!";...
Forum: Perl Jul 27th, 2009
Replies: 4
Views: 399
Posted By KevinADC
or using a loop:


use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $success = 1;
for (1..5) {
my $req = $ua->get( 'http://some.web.site');
if ($req->is_success) {
print...
Forum: Perl Jul 27th, 2009
Replies: 2
Views: 465
Posted By KevinADC
typically you would use the CPAN shell to install modules with Linux. This part of the perl documentation should help you:

http://perldoc.perl.org/perlmodinstall.html

Note it is written for...
Forum: Perl Jul 27th, 2009
Replies: 2
Views: 499
Posted By KevinADC
You never said what error you were getting but I am assuming you were getting a warning and not an array.

Scalar value @array[$marker] better written as $array[$marker] at script line 9 .

When...
Forum: Perl Jul 22nd, 2009
Replies: 4
Views: 396
Posted By KevinADC
use eval unless you really want to think of perl like C.

http://perldoc.perl.org/functions/eval.html

I assume the module is just a wrapper around eval but I haven't looked at the source code.
Forum: Perl Jul 22nd, 2009
Replies: 4
Views: 396
Posted By KevinADC
Perl has no such inbuilt functions/operators try and catch.
Forum: Perl Jul 19th, 2009
Replies: 1
Views: 613
Posted By KevinADC
I'm going to suggest you ask this question on www.unix.com in the shell scripting forum:

http://www.unix.com/shell-programming-scripting/
Forum: Perl Jul 15th, 2009
Replies: 2
Views: 302
Posted By KevinADC
anywhere you are opening a file in the script:

open(USERLIST, "./User Lists/$infile.csv");\

change to:

open(USERLIST, "./User Lists/$infile.csv") or die "Can't open ./User Lists/$infile.csv:...
Forum: Perl Jul 14th, 2009
Replies: 2
Views: 309
Posted By KevinADC
WWW::Mechanize does not come with perl it has to be installed. You can see a listing of all perls core modules here:

http://perldoc.perl.org/index-modules-A.html
Forum: Perl Jul 7th, 2009
Replies: 5
Views: 393
Posted By KevinADC
There is no standard way that I am aware of. It really makes no sense to search a bin file for "words" but maybe for school work it does.
Forum: Perl Jul 7th, 2009
Replies: 6
Views: 623
Posted By KevinADC
The google search found many many examples, so I assume you didn't search, and I assume you don't want anymore help from me. I'll just take my smart ass over to another thread and help people that...
Forum: Perl Jul 7th, 2009
Replies: 6
Views: 623
Posted By KevinADC
You need to use a file test operator -M or the stat() function to get the date and the sort() function to sort them. But I bet a Google search would find plenty of examples of code already written,...
Forum: Perl Jul 7th, 2009
Replies: 5
Views: 393
Posted By KevinADC
considering that a .bin file is a compressed and encoded file its no wonder you can't just open it like a text file.
Forum: Perl Jul 1st, 2009
Replies: 6
Views: 533
Posted By KevinADC
If you write the regexp like this:

/Check 8/

it will match that substring inside of any larger string, so "Check 8000" would match, but not "Check 1008" it would also match "PreCheck...
Forum: Perl Jul 1st, 2009
Replies: 6
Views: 533
Posted By KevinADC
It will match. I just posted code that proves that. But your correct, it works fine without the // delimiters.

Are you using chomp() on the user input before using it in the regexp?
Forum: Perl Jul 1st, 2009
Replies: 6
Views: 533
Posted By KevinADC
Well, the first thing is to properly construct your regexp:

if($data =~ /$user_input/){then do something;}

assuming $data is the number like 1008 and 800, etc, and $user_input is the number 8...
Forum: Perl Jun 30th, 2009
Replies: 3
Views: 407
Posted By KevinADC
There is no pearl language but there is perl. Is it the easiest? No. There are plenty of perl books, you want "Learning Perl" the newest edition. Search for it on amazon.com

The easiest language...
Forum: Perl Jun 29th, 2009
Replies: 5
Views: 409
Posted By KevinADC
Yep, thats probably the reason.

my @contents = ();
if (-e $path_to_file)
{
open (FILE, $path_to_file) or die "$!";
@contents=<FILE>;
close(FILE);
}
print "$_\n" for @contents;
Forum: Perl Jun 28th, 2009
Replies: 4
Views: 587
Posted By KevinADC
We are adding a newline to the output when the lines of the file already have a newline at the end so we create double-spacing for any line that already has a new line. Sometimes the last line of a...
Forum: Perl Jun 28th, 2009
Replies: 4
Views: 587
Posted By KevinADC
OK, now the easy way......


open(LISTFILE, $filename);
@filearray = <LISTFILE>;
close LISTFILE;
print "$_\n" for reverse @filearray;
Showing results 1 to 40 of 898

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC