#!/usr/bin/perl

my ($x,$y,$z);

$x = "aabddbcc";

$x =~ /aa.*cc/;

print $&, "\n";
my $a;

$y = join "",(jj,kk);

print $y, "\n";


#$y = <>;
#print $y;
#($z,$a) = $y =~ /^(hi) (.+)/; 

print $z, "  -  ", $a, "\n";

# perl shell
#while (<>) { eval; print $@; }

my @vars;
$y = <>;

#@vars = ($y =~ /(\$[a-zA-Z]\w*.*?)*/);

@vars = split /(\$[a-zA-Z]\w*)/, $y;

my @ivars;

foreach (@vars) { if ($_ =~ /\$[a-zA-Z]\w*/) {push(@ivars,$_);} }


foreach (@vars) {print $_, " ";} print "\n";

foreach (@ivars) {print $_, " ";} print "\n";  # worked!


# would need my @vars = ($_[0] =~ /.../)

my ($a,$b,$c) = (1,2,3);
print '('.(join',',@ivars).') = (5,7,11);';  print "\n";
eval ("(".(join ",",@ivars).") = (5,7,11);");
print $a, $b, $c;  print "\n";

$a = "ppprrr";
$a =~ s/ppp/qqq/;
print $a;  print "\n";

my $aa = 3;
print (eval '3; $aa;\n');



# from krish:

  $var = '$n';
  $target = 'Will $n change?';
  print "At start \$target is '$target' \n";
  # Change $var so that the '$n' becomes '\$n'
  $var =~ s/\$/\\\$/;
  $target =~ s{$var}{\$m};
  print "At end   \$target is '$target' \n";



$a = '$n:$>1:$n==0';

$b = split /:/,$a;
print $b;  print "\n";


print (3<2), "\n";
