Monthly Archives: November 2013

Using Arrays and Loop in Perl

#!/usr/bin/perlprint “Printing the for loop \n”;for($count=10;$count>=1;$count–){print “$count \n”;} print “Now printing the array \n”;@a=(1,2,3,4,5);print “@a \n”;

Posted in Uncategorized | Tagged | Leave a comment

Using Basic Arithmetic Operations in Perl

#!/usr/bin/perlprint “Welcome to Arithmetic Operations in Perl”$a=10;$b=$a+10;print $b;

Posted in Uncategorized | Tagged | Leave a comment

Perl Basics-Hello Perl

Step 1:Go to a Unix machine. Step 2:Find in which directory perl is installed by typing the following command: which perl. Step 3:Create a new perl file[hello.pl] .Enter the below line of code.In my case perl is installed at /usr/bin/perl.Once … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

Using Prompt dialog box in JS

<!DOCTYPE html><html><head><meta charset=”ISO-8859-1″><title>Insert title here</title></head><body><script>function myfunction(){ var x=prompt(“Enter your name”); if(x!=null) { document.getElementById(“demo”).innerHTML=x; } else { alert(“Please Enter your name”); } }</script><p id=”demo”> Message</p><button type=”button” onClick=”myfunction()” >Try Me</button></body></html>  

Posted in Uncategorized | Tagged | Leave a comment

Using Confirm box

<!DOCTYPE html><html><head><meta charset=”ISO-8859-1″><title>Insert title here</title></head><body><script> function myfunction(){var r=confirm(“Press a button”);if(r==true) alert(“You pressed Ok”); else alert(“You pressed False”);} </script> <button type=”button” onClick=”myfunction()”>Confirm</button></body></html>

Posted in Uncategorized | Tagged | Leave a comment

Error Handling in JS

<!DOCTYPE html><html><head><meta charset=”ISO-8859-1″><title>Error Handling</title></head><body><script> function message(){ var txt=””; try { addAlert(“This is an exception”); } catch(err) { txt=”There was an error on the page. \n\n”; txt+=”Error Description is “+err.message +”\n\n”; alert(txt); } }</script> <input type=”button” value=”Click Me” onClick=”message()”></body></html>

Posted in Uncategorized | Tagged | Leave a comment

Using If Else JS

<!DOCTYPE html><html><head><meta charset=”ISO-8859-1″><title>This is my first JS Function</title></head><body><h1> Fist JS Function</h1> <script> function myfirstfunction() { var x=12; if(x>=10) alert(“Greater than 10”); else alert(“Less than 10”); } </script> <button type=”button” onClick=”myfirstfunction()”>Try It Out</button></body></html>

Posted in Uncategorized | Tagged | Leave a comment