#!/usr/local/bin/perl
############################################################################
# Script name: Sample script for Perl Highlighting scheme
# Date: Saturday, January 9, 1999 at 14:40
# Author: Denis Stan\v{c}er
# Note: This heading is created with #!! Active String
############################################################################
do{
foreach $scalarvariable(@array){
$scalar_with_underscore = "string with specials\t\n and $variables, \@arrays, \%hashes\n";
$scalar_with_numbers_123 = 'literal';
$has_hash = "this is not a \# comment";
$has_quote = "This is \"quoted\" quote";
$has_singles = 'This is \'literated\' literal';
$MixedCaseScalar = `backtick`;
@array_with_underscore_and_numbers_1234 = qw(one, two, three);
$last_array_index = $#array;
%hashtable=(a => 1, b => 2, c => 3);
%hash_with_underscore_and_numbers_56 = ( 1 => a, 2 => b, 3 => c);
$subroutine_result = &subroutine_with_underscore_and_numbers_99($input);
*typeglob = *typeglob_with_underscore_and_numbers_77;
}
print "Enter something (exit quits): ";
$ans = <STDIN>;
$out = (length($ans) % 2) == 0 ? uc($ans) : lc($ans);
print $out;
LABEL:
# references
$scalar = \@array;
%hash = \&subroutine($var);
$pointer = \*typeglob;
$$scalar_reference = %$hash_reference;
# some strandard functions
chomp;
print "$variable\n";
# some regex
@splited_array = split(/\S.*\D[^\B]\w?.*\s+$/,$scalar);
$substitute =~ s/\n\n+/\n/g;
# $transliterate =~ tr/(\w+)/\U$1\E/g;
$regex_look_alike_path_string = "/usr/local/bin/perl";
die "Error! ($!)\n" if(/\s+word $fun\S+$/);
}while($ans !~ /exit/i);
############################################################################
# Sub name: Subroutine example
# Input: price, list of names
# Output: total price
# Note: This heading is created with subb Active String
############################################################################
sub subroutine {
my($scalar,@array)=@_;
my($out,$local_variable);
do {
$local_variable=$#array * $scalar;
};
$out = abs($local_variable);
$out;
}