KevinADC 192 Practically a Posting Shark

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

KevinADC 192 Practically a Posting Shark

my bad about the code in the regexp. That was something new for me. I looked it up and sure enough:

A bit of magic: executing Perl code in a regular expression

Normally, regexps are a part of Perl expressions. Code evaluation expressions turn that around by allowing arbitrary Perl code to be a part of a regexp. A code evaluation expression is denoted (?{code}), with code a string of Perl statements.

Be warned that this feature is considered experimental, and may be changed without notice.

Note the last sentence in the above quote from perldoc. The feature is considered experimental, which basically means use it at your own risk and it may not even work properly. Quote taken from perl 5.10 and the perl regexp tutorial posted on the perldoc website.

One change I would recomend is to change this ineffcient loop:

while(@swaptemp) { # loop through the array
   $swapstring .= $swap{ pop(@swaptemp) } ; # symmetry swap
}

this should work better:

for (reverse @swaptemp) { # loop through the array backwards
   $swapstring .=  $swap{ $_} ; # symmetry swap
}

or maybe:

for ( @swaptemp) { # loop through the array
   $swapstring .=  $swap{ $_}# symmetry swap
}
$swapstring = reverse $swapstring; # reverse the string

As far as the other problem(s), I really have no idea. Ask on the BioPerl website or maybe someone on www.perlmonks.com will be able to help.

KevinADC 192 Practically a Posting Shark

It appears you are just running out of memory. Where the error occurs is here:

symmetryfinder.pl line 183

Your regexp does not appear to be valid. I don't think you can run code inside a regexp like that. Maybe it is something new with perl 6 I am not aware of.

KevinADC 192 Practically a Posting Shark
foreach my $name (@required)
		$name = trim($name);
		next;
}

the "next" keyword in the above loop is unecessary.

KevinADC 192 Practically a Posting Shark

The warning will have no affect on the program. If you don't want the warning issued you can elect not to use the warnings pragma or use the "no warnings" switch in a block of code. See the warnings pragma documentation for details.

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

KevinADC 192 Practically a Posting Shark

I think the problem is your use of 'wanted2' as the name for the callback function. I think it has to be 'wanted'. Just use "wanted" and ignore the warning about "sub wanted redefined".

KevinADC 192 Practically a Posting Shark
KevinADC 192 Practically a Posting Shark

CGI scripts must return something to the browser, at minimum that would be an HTTP header. The header must also be printed before anything else gets printed back to the browser.

#!/usr/bin/perl
use CGI qw(:standard);
print header; #<-- prints the http header using the CGI module
my $button_value = param('name');
print $button_value;

See the CGI modules documentation for details.

KevinADC 192 Practically a Posting Shark

I have already suggested what you need to do on the other forum, use some regexps. You have to show some effort at writing the regexps before I will continue to post further suggestions.

KevinADC 192 Practically a Posting Shark

he has been getting help on another forum, so he may not respond here.

KevinADC 192 Practically a Posting Shark

Ask on a IIS discussion forum how to set it up to run CGI scripts. You can also google for apache howtos or tutorials that explain the setup process.

http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla:en-US:official&hs=IfF&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=setup+apache+windows+xp&spell=1

KevinADC 192 Practically a Posting Shark

Do you have an http server installed on your XP machine and perl? You can install and configure the apache http server on your XP box and run your perl based CGI scripts. If you want to get your two boxes communicating you will have to network them and setup one up as a server, but I can't help you with that and that has nothing to do with perl anyway.

KevinADC 192 Practically a Posting Shark

basic script with no formatting of output:

use warnings;
use strict;
use File::Find;

use File::Find;
    find( {wanted=> \&wanted, no_chdir => 1}, 'C:/Program Files/Player' );
    sub wanted { print $_,"\n"; }

See File::Find (a core module) for details.

raul15791 commented: good! +1
KevinADC 192 Practically a Posting Shark

I think he wants to use File::Find to browse all files in all sub folders.

KevinADC 192 Practically a Posting Shark

There is no trial version for Komodo Edit... it is free. Komodo IDE has a trial version. I think you are maybe confusing Komodo Edit ( a new product) with Komodo IDE.

I use Perl Builder 2 Pro IDE. Its not as powerful as Komodo IDE but I don't need all that power.

I don't even do any perl programming anymore. I basically post on forums so I don't forget how to code perl.

KevinADC 192 Practically a Posting Shark

Both.
Not necessarily, in komodo you can edit Perl, Python, ruby... but you need to set interpreter(in case of perl) path. I like interactive shell(Perl) the most, where i can test something on the go, which i am really confused of or try new things.

katharnakh.

Komodo Edit is also an IDE? Seems odd they would post a free IDE when they sell Komodo IDE for $295. I think Komodo Edit is just an editor, but I could be wrong as I have never downloaded it.

KevinADC 192 Practically a Posting Shark

For an editor you might want to use a 'upgraded' version of notepad with syntax highlighting such as notepad++or try komodo edit which is avaible from activestate, the same place you probably got the perl interpreter from http://www.activestate.com/store/download.aspx?prdGUID=20f4ed15-6684-4118-a78b-d37ff4058c5f
I do not know why you would want JEditor because i just googled it and it is a java IDE, and perl inst java :)
AS for ebooks, i managed to download a [removed] , but you can find free perl ebooks on the web which are downloadable legally so its up to you what books you get

Hope that helps

HLA91

Its definetly not cool to inform people where to download pirated copies of perl books and other materials. I know many of the authors of perl books, via forums and CPAN, and I know they put a lot of time and effort into writing those books and don't appreciate being ripped-off.

KevinADC 192 Practically a Posting Shark

I don't think that Komodo Edit is an IDE (Integrated Development Environment). As the Komodo Editor page says: its an editor based on Komodo IDE. Komodo Editor is a text editor, albeit one that has many nice features and support for scripting languages.

Activeperl does not come with any IDE. I posted the URL to a free IDE, it may not be the best IDE but its pretty good for free. Komodo IDE is supposed to be excellent, but I have never used it. Its also $295.

KevinADC 192 Practically a Posting Shark

I tried Komodo Edit 4.3. It's quite good. Easy to use and simple.

Anyway, thanks guys for all the suggestions...

Looks like a real good editor. Good choice. I still recommend you install perl and use and IDE, makes writing scripts much easier.

KevinADC 192 Practically a Posting Shark

I think you would have missed the comment made in the code posted by me. my point was was simple,

ahhh.... yes, sorry. I missed the comment.

KevinADC 192 Practically a Posting Shark

At best the url is just wrong, you left out the cgi folder in the path:

http://localhost/cgi/hello.cgi

At worst your server is not setup correctly, but I know nothing of Tomcat, which is not a perl topic anyway, but an http server question. The fact you can't run the perl script has nothing to do with perl, but with the server.

KevinADC 192 Practically a Posting Shark

One another thing forgot to mention in the last post, the way you check for existence of a key in hash(phonebook) is not right way. Because if you take this eg: then will come to know

my %h = (a=>undef);
if ($h{a}){print $h{a};}  # this way you check, but it should like,
if (exists $h{a}){print $h{a};#but the value is undefined, so you can check this as well and print some useful message}

katharnakh.

I think your example is a little misleading. If all he did was check for the existance of the hash key and it is undefined (or has a value of undef) he will get a false positive if the key exists but has no value.

#!/usr/bin/perl;
#playplay.pl

use warnings;
use strict;

my %phonebook = (
    dog => "7777777",
    cat => "8888888",
    monster => "99999999",
    cow => undef,
);

#print ("Please Enter a name to be search:\t");
$nama = 'cow';

if(exists $phonebook{$nama})
{
     print ("The phone number of $nama is $phonebook{$nama}");
}

else
{
     print ("The phone number of $nama cannot be found.");
}

But if the code is run as originally coded it will produce the correct output:

#!/usr/bin/perl;
#playplay.pl

use warnings;
use strict;

my %phonebook = (
    dog => "7777777",
    cat => "8888888",
    monster => "99999999",
    cow => undef,
);

#print ("Please Enter a name to be search:\t");
$nama = 'cow';

if($phonebook{$nama})
{
     print ("The phone number of $nama is $phonebook{$nama}");
}

else
{
     print ("The phone number of $nama cannot be found.");
}

Even …

KevinADC 192 Practically a Posting Shark

What you want is an IDE, a good free one is Perl Express

http://www.perl-express.com/

I think its only for Windows operating systems. Install activeperl from www.activestate.com then use the IDE to run write and run your perl scripts.

I believe you can also use it as just an editor if you don't want to install perl.

Some free ebooks:

http://www.perl.org/books/library.html

Most still relevant if a little out of date in reagards to the newest version of perl: 5.10.

raul15791 commented: useful +1
KevinADC 192 Practically a Posting Shark

Look into List::Permutor

KevinADC 192 Practically a Posting Shark

javascript can only communicate with the perl script via the form. Do whatever you want with the javascript, but it has to set a form field to some value and then send the form data back to the perl script to process the data. Perl then accepts the data, processes it, and sends data back to the browser. But there is never any direct interaction between perl and javascript, they operate in two different environments, they can only communicate via the form.

Perl can print javascript while it outputs html back to the web browser and fill in javascript code with whatever data is needed by the javascript to run in the web browser, but once perl outputs the html/javascript code to the web browser it has no concept of what occurs after that until some form data is sent back to the perl script via the form.

There is also AJAX which is a blending of javascript and CGI scripting, but the process is essentially the same as described above although the interaction in the web browser looks different.

KevinADC 192 Practically a Posting Shark

javascript and perl are two entirely different things. Perl has no concept of javascript and the same is true in reverse. What you need to do is a send some data to your perl script via a CGI form and use that data to tell your perl script what to do, like run a certain subroutine in your perl script.

As far as the chmod goes, it is possible to change file permission with perl, use perls chmod function.

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

KevinADC 192 Practically a Posting Shark

I don't understand what your requirement is.

KevinADC 192 Practically a Posting Shark

what have you tried so far?

KevinADC 192 Practically a Posting Shark

Your file paths are windows, not DOS. Windows supports forward and backslashes in directory paths, but its safer to use forward slashes because the backslash is a special character in perl. If by ticks you mean quotes, the quotes in your code look OK to me.

KevinADC 192 Practically a Posting Shark

If the directory and file are correct, I have no idea why perl can't open the file. There is no CHMOD on Windows servers (that I am aware of).

KevinADC 192 Practically a Posting Shark

the exec() function in perl never returns to the perl script. Once you use it your perl script is exited. Ask on www.perlmonks.com if you do not get the answer on this forum.

KevinADC 192 Practically a Posting Shark

shows us your current code that tries to insert the image.

KevinADC 192 Practically a Posting Shark
KevinADC 192 Practically a Posting Shark

ahh...my bad, I also missed that. You should not assign a return value from the chomp function, it should just be:

$var = "some value\n";
chomp($var);

Note: chomp() only removes the input record seperator from the end of a line or string, which is generally a newline, it does not remove spaces.

KevinADC 192 Practically a Posting Shark

print qq{
all your popup code here
};

KevinADC 192 Practically a Posting Shark

start with a simple script. Use a form with one text field: 'test'.

#!/usr/bin/perl
use warnings;
use strict;
use CGI qw(:standard);
print header;
print start_html; 
print param('test');
print end_html;

if that still crashes then your install of perl is bad or is maybe a non standard distribution.

KevinADC 192 Practically a Posting Shark

Nobody here is going to debug your script. If it does not work describe what is not working and any error messages you get. Then maybe someone can try and help.

KevinADC 192 Practically a Posting Shark

This is not tech support, we don't do peoples work for them unless they show some effort.

KevinADC 192 Practically a Posting Shark

Yes, but it still does the same thing, it only tells you if the files (or in this case the lines) are equal or not, and it stops as soon as a difference is detected. So there is no way to compare what the difference is between two files using File::Compare, only if they are the same or not.

KevinADC 192 Practically a Posting Shark

File::Compare does not do this type of comparing it just tells if files are the same or not the same.

KevinADC 192 Practically a Posting Shark

Like anyone here is supposed to understand your vague requirements? How come you have no idea where to start?

KevinADC 192 Practically a Posting Shark

WWW:::Mechanize does not support javascript (which is clearly documented in the modules manpage on CPAN). Look into Win32::IE::Mechanize

KevinADC 192 Practically a Posting Shark

I don't think you want to be using getc(). I'd just slurp the file or process it line by line. You can use the length() function to count all characters in a string or line. Use split() to try and count words, and maybe split to also count paragraphs.

KevinADC 192 Practically a Posting Shark

Be more specific, what part do you need help with? It looks like you have the general idea of how to do the assignment although there might be better ways to code it, that is not important right now. Learning is incremental, you will learn better methods as you go.

What is unfortunate is that that you are not using "strict" or "warnings", so the quality of your perl course is in question.

KevinADC 192 Practically a Posting Shark

I give up, all yours katharnakh.

KevinADC 192 Practically a Posting Shark

Actually, I signed up to look over what might be useful in perl craft...

Found cruft instead...

Better perl forums:

tek-tips.com
devshed.com
perlmongers.com
experts-exchange.com

KevinADC 192 Practically a Posting Shark

You declared perl is headed to the graveyard, if you ask me, python will probably get there sooner judging by it lower usage and it's been around as long as perl if not longer in one form or version or another.

But anyways, thats my last post in this thead. These discussions might be of some small personal interest but never change anyones mind about anything.

Parting shot:

Python 3000

There are plans for a future version, to be called Python 3.0 (the project is called "Python 3000" or "Py3K") that will break backwards compatibility with the 2.x series in order to repair perceived flaws in the language.

jephthah commented: interesting. i did not know that. +2
KevinADC 192 Practically a Posting Shark

plz check it if it is the correct way to do it.

Sorry, but I am not a mind reader. I have no idea what your code is supposed to do. See katharnakhs post.

KevinADC 192 Practically a Posting Shark

If you want to process the even number indices of an array:

for (my $i = 0; $i <= $#array; $i+=2) {

KevinADC 192 Practically a Posting Shark

post your perl code and post any error messages you get when you run the perl code.