I notice that the file source.txt is opened once and the file compare_with.xml is opened many times.
Not knowing the size of each file, I would suggest to scan source.txt once and make an array of expressions out of the file. Subsequently loop through file compare_with.xml once, and compare...
You can use a Stack class to create your calculator stack.
The algorithm to evaluate arithmetic expressions is relatively simple. A complete example is given in Chapter 3 of Robert Sedgewick'S Algorithms in C (or the latest book, in Java), or Chapter 9 of Herbert Schildt's The art of C++ (or...
You can start by checking the cpan library for routines that allow you to surf the web using Perl, for example:
http://search.cpan.org/~gaas/libwww-perl-5.808/lib/LWP.pm
then there are others that help you manipulate your sql database, such as:
http://search.cpan.org/search?query=mysql&mode=all
If for some security or other reasons you cannot post the data, you can successively remove the last half of the data and try the sort again. If you repeat for about 8 times (120 lines), the program is bound to work. Check what you have last removed to make it work, and you may be surprised to...
Even though DOS or Windows does not differentiate between upper and lower case file names, javac does. The file name that you supplied is a parameter to the compiler, and the case is sensitive for the file name (and probably for the path as well).
Display the file name and the path, and try...
As far as I know, most PostScript processors don't really care if your document exceeds the paper size: the excess just doesn't show up on paper.
Thus, in theory, you can send the same document to the printer four times, with the appropriate translation of the origin, you will get the required...
While answering one's own question sounds a little... studpid, for lack of a better word, it is sure efficient, as you said, saving everyone else from having to work on the problem if an answer has already been found.
I vote your answer with the embedded modifier as the best, as it can be...
You're right, we're lucky to have the masters around, and most of all, helping out. I learn quite a bit by reading the posts and the answers.
Nice talking to you, cheers.
Looks like you work with Perl a lot from the number of answers you've given. I am new to Perl, so it's almost sure I will need some help from you some day!
Cheers.
Max1x,
Perhaps I didn't express it correctly.
What I mean is that the code will insert the element and quit as soon as it finds a different array in newArray. If the first element happens to be different from array[4], then it will be inserted and quit without checking for duplication of the...
...following, which will only match matching tags, and case-insensitive.
$line ="<AB>hello</CD>";
$line1="<Hey>Good Day</HEY>";
if($line =~ m'<(\w+)>.*</\1>'i){printf("A1:%s\n",$1);}
if($line1 =~ m'<(\w+)>.*</\1>'i){printf("A2:%s\n",$1);}
if($line =~...
The link you provided gave the answer, I only need the letter m before delimeters other than /. Thus the line should now read, and it works perfectly.
$line="http://www.abc.comHTTP://www.def.comhttp://www.ghi.com";
@array=split m'(?=http://)'i, $line;
foreach $i (@array){printf("%s\n",$i);}
Hello MillerH,
Your code works perfectly with the look-ahead extension.
While I was trying to add the modifier 'i' to make it case insensitive, I succeeded in doing it if I use '/' as a delimiter, but it leads to awkward code.
I understand that a prefix operator is required if we do not use /...
max1x, it looks like that the code shown will add the element as long as the $newArray[0] does not equal to $array[4].
The following code should work, perhaps a little awkward.
# add fifth element if not a double in @newArray
my @array=(1,4,7,10,11);
my @newArray=(2,5,6,7,8,10,9);
my...
I would try the install on another (fresh) machine to see if the problem lies with the install files, or whether there are some interactions with your existing applications.
For users of ActiveState Perl running on Windows XP etc, try the Schedule-Cron-Events module.
http://search.cpan.org/~pkent/Schedule-Cron-Events-1.8/lib/Schedule/Cron/Events.pm
Note that you'd have to define the Environment variable TZ as your timeZone, or else the example won't run.
Back to the duplicate checking, you could try the following. This will work if there is uniformity in the addresses. A sort is necessary before removing duplicates. On an Intel P-3 machine, a 108,000 line file was read and processed in 4 seconds.
open (IN,"<xxx.in");
open (OUT,">xxx.out")...
Actually, stop executing the applet, and if it is executed from a web-browser, return to the previous page. Loosely speaking, the equivalent of System.exit() in a normal Java program.
If the behaviour is different between a local execution and a web applet, I would like to know what to do in...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.