answersLogoWhite

0

Perl Programming

Perl was first released in 1987, it is an high-level, general-purpose, interpreted, dynamic programming language. It was created by Larry Wall. The language is influenced by a number of programming language such as Lisp, C, C++, Pascal and others.

319 Questions

Pokemon perl how to get surf?

User Avatar

Asked by Wiki User

When you've defeated Kevin (your brother) at Snowsoft Gym, go to Wally's dad's house and he should give you surf (just like in the normal Emerald game).

How do you sum up numbers from 1 to n?

User Avatar

Asked by Wiki User

  1. import java.util.Scanner;
  2. public class average {
  3. static int i=0;
  4. static double sum = 0;
  5. static double average = 0;
  6. public static double calcSum(double sum){
  7. double count;
  8. Scanner input = new Scanner(System.in);
  9. while(i < 5){
  10. count = input.nextDouble();
  11. sum = sum + count;
  12. i++;
  13. }
  14. return sum;
  15. }
  16. public static double calcAverage(double average){
  17. double sum = calcSum(sum);
  18. average = calcSum(sum) / 5;
  19. return average;
  20. }
  21. public static void main(String[] args) {
  22. System.out.println("Please enter 5 numbers.");
  23. System.out.println("Sum is: "+calcSum(sum));
  24. System.out.println("Average is: "+calcAverage(average));
  25. }
  26. }

How do you call a perl program from javascript?

User Avatar

Asked by Wiki User

You can call the Script like this,

<script type="text/javascript" src="perl_script.pl"></script>

So you just replace a regular Javascript Call ( .js ) with the .pl Script.

Inside the Perl Script you will have to use embraced Javascript Functions / Code,

f.e. like print "document.write.('Hello World');";.

How can you calculate the average and median in perl by subroutine?

User Avatar

Asked by Wiki User

<pre>

sub average {

@_ 1 or die ('Sub usage: $median = median(\@array);');

my ($array_ref) = @_;

my $count = scalar @$array_ref;

# Sort a COPY of the array, leaving the original untouched

my @array = sort { $a <=> $b } @$array_ref;

if ($count % 2) {

return $array[int($count/2)];

} else {

return ($array[$count/2] + $array[$count/2 - 1]) / 2;

}

}

</pre>

Write a program to accept two numbers and display their sum?

User Avatar

Asked by Wiki User

Assuming you're using the C programming language (as you did not specify any other), and that you're making some sort of arithmetic tester, a simple answer would be:

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main()

{

time_t seconds;

time(&seconds);

srand((unsigned int)seconds);

int num1 = (rand()%100);

int num2 = (rand()%100);

int sum = num1 + num2;

int ans;

printf("What is %d + %d? ", num1, num2);

scanf("%d", &ans);

if(ans == sum) printf("Correct!");

else printf("Wrong, correct answer is %d", sum);

return 0;

}

Why was perl invented?

User Avatar

Asked by Wiki User

The Perl programming language was developed by Larry Wall in 1987. It has since been more developed by programmers to revamp the language. In 2000 developers announced a complete overhaul of the language.

What is fullform of perl?

User Avatar

Asked by Mahimaji

perl- Practical Extraction and Report Language

How perl is used?

User Avatar

Asked by Wiki User

What is perl programming?

User Avatar

Asked by Wiki User

Perl is a programming language developed by Larry Wall in the late 1980s to assist him in administering UNIX operating system environments. Perl has since been ported to other operating systems such as Microsoft Windows and Linux. Perl is widely renowned for its ease of use, power and functionality.

Perl is loosely based on the powerful 'C' programming language developed by Dennis Ritchie of Bell Labs in the early 1970s. Perl is used today for a wide variety of tasks including CGI programming, system administration and is also a favorite of both computer security professionals and so called 'hackers'.

Shell scripting is associated with the use of a variety of 'shells' such as the 'Bourne Shell' developed by Stephen Bourne, also of Bell Labs, the 'Korn Shell' developed by David Korn, again while at Bell Labs and other widely used shells such as the ubiquitous 'BASH' shell (Bourne Again SHell) included with virtually every open source operating system such as Linux, OpenBSD, FreeBSD and some closed source ones. Shell scripting has, to some degree, more recently come to be associated with 'batch/cmd file' programming in Windows environments.

A 'Bourne Shell' script will typically begin with the line:

#!/bin/sh

while a 'Perl' script may begin with the line:

#!/usr/bin/perl

Perl has remarkably high performance for a scripting language that is compiled at

runtime. In benchmarks studies, Perl has often been found to run at approximately 90% of the speed of the very high performance C programming language.

Perl supports networking, multi-tasking and other features expected of a modern programming language and also has a considerable body of Unix/Linux administration functions built in (in keeping with it's original focus of being a scripting language designed by a Unix Systems Administrator for Unix Systems Administrators - perhaps most often meaning Linux today, though FreeBSD, OpenBSD and Mac OSX [to name but a few as Perl is ubiquitous and any list of systems supported would be FAR too long to be enumerated here] are equally well supported).

I have written Perl scripts that run in daemon mode for instance, and launch hundreds of child processes performing many varied tasks including network clients and servers.

Perl is Open Source and the CPAN (Comprehensive Perl Archive Network) body of contributed code and modules is so extensive it's enumeration would be a task nearly encyclopedic in scope - FAR TOO LARGE EVEN FOR AN ONLINE ENCYCLOPEDIA SUCH AS WIKIPEDIA.

In early 2013 if I'm not mistaken, the ISS (International Space Station) switched from Windows to Linux for the announced purpose of increased reliability and stability encompassing dozens of computers - each of which comes equipped with Perl.

And last but not least, writing Perl code is just plain fun. Few, if any programming languages are more portable as Perl has been ported to everything from Microsoft Windows to IBM AIX.

We Linux Systems Administrators are, at least philosophically, indebted to Larry Wall, Randall Schwartz, Nathan Torkington and many others for their profound contributions to the Open Source software arena in the form of Perl.

What is perl good for?

User Avatar

Asked by Wiki User

The Perl Programming system is used to script language for computer tasks or programs. It can write scripts for science, finance, graphics and system administration programs.

What is the difference between c plus plus and perl language?

User Avatar

Asked by Wiki User

Borland C++ was the successor to Turbo C++ and primarily included a better debugger. The product was later renamed Borland C++ Builder before Borland divided the company and passed all development systems to their CodeGear subsidiary, which produced CodeGear C++ Builder. However, all CodeGear products are now owned by Embarcadero Technologies, thus Embarcadero C++ Builder is the latest incarnation.

What is the difference between array and hash?

User Avatar

Asked by Wiki User

An array stores elements in a sequential order from zero (or one) up to the size of the array (possibly minus one, if starting from zero). Arrays come from the classic days of computer programming performed with assembler code, where one would often have a base pointer (BP or BX) plus an index (SI or DI) plus a constant offset, if any.

To address the fourth element in an array, one would specify the BP of the array's initial index (index 0), then add an index to it. For example, add [bp+di], ax would add the contents of AX (a 16-bit register) to the memory location referenced by BP with DI added to it, both also 16-bit registers in classic assembler. Some languages, such as BASIC, ignored the zero index or used it for other purposes.

Arrays are generally fixed in size-- reallocation is necessary to increase or decrease the size of the array. They must also be initially allocated with some amount of memory before they can be used. Newer languages offer dynamic arrays, sometimes called vectors (a point with a line that has an infinite length) to represent arrays that automatically scale capacity as it is filled.

Hashes, in contrast, do not use traditional indexes; they are not represented by the bp + di model, but instead use objects as their indices. This leads to certain inconveniences, because objects are not necessarily sorted from smallest to largest, or lexicographical order, but simply by computed indexes based on the key's hash. Most languages smooth out this limitation by using b-trees (binary trees) to store the keys and their indices, so that iterations over the values of the hash are in key order, but this is not strictly a requirement.

Hashes have no maximum size, unlike traditional arrays. Increasing the size of the hash is a simple as assigning a new key a value. In this respect, they are similar to vectors, but they answer an important question: how does one find an element in a vector in constant time? The answer, of course, is that vectors must be traversed from the first index to the target index in order to find the value, so searches require linear time to find a value.

By using keys, the search complexity is reduced from linear time to constant time, offering a significant advantage on looking up data versus using a vector, linked list, or even an array of objects. Hashes use constant time look ups, just like an array does, but gives the added flexibility of specifying how the data is indexed, instead of just a number. This is especially useful for algorithms involving translating data (ETL) or looking up data that meets a certain criteria repeatedly in constant time, which can have a savings factor of hundreds or thousands times more than an array.

What is Perls test?

User Avatar

Asked by Vishnumukundan

a test for hemosiderin, utilizing Perls Prussian blue stain.

How you redirect the output of the perl script into some file using perl script?

User Avatar

Asked by Wiki User

If the perl script outputs to the standard output device, use the I/O redirection operators (>, >>, |) to redirect it somewhere else.

Difference between perl scripting and shell scripting?

User Avatar

Asked by Wiki User

Perl is a scripting language. It is not, however, a shell scripting language because Perl is not a shell program. A shell program is one that usually interacts with a user and provides certain user interface abilities. Perl was not designed for that purpose.

You can certainly program a shell to operate in various fashions. A shell script is usually provided for redundant tasks and series of commands, unattended operation, and so forth.

Perl is a "kitchen sink" of ways to interact with data, databases, networks, and so forth. It is a great language for manipulating text in various ways.

What is PERL acronym for?

User Avatar

Asked by Wiki User

Practical Extraction and Report Language. It is a programming language used by websites and many other things.

How does one use the Perl chomp function?

User Avatar

Asked by Wiki User

The Perl Chomp function is a programming function that remove the "newline" character at the end of the string. One can use the Perl Chomp function to remove any character that has the same value as the current one.