










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











































#!/ex2/usr/bin/perl
while ($line = ) { if ($line eq "\n") { next; } print "$line"; }
#!/usr/local/bin/perl
foreach $file (@ARGV) { print "Processing $file\n"; if (-e "fixm_temp") { die "*** File fixm_temp already exists!\n"; } if (! -e $file) { die "*** No such file: $file!\n"; } open DOIT, "| tr '\015' '\012' < $file > fixm_temp" or die "*** Can't: tr '\015' '\012' < $infile > $outfile\n"; close DOIT; open DOIT, "| mv -f fixm_temp $file" or die "*** Can't: mv -f fixm_temp $file\n"; close DOIT; }
$a = $b. $c; # Concatenate $b and $c
$a = $b x $c; # $b repeated $c times
$a = $b; # Assign $b to $a
$a += $b; # Add $b to $a
$a -= $b; # Subtract $b from $a
$a .= $b; # Append $b onto $a
foreach $morsel (@food) { print "$morsel\n"; print "Yum yum\n"; }
#!/usr/local/bin/perl print "Password? "; $a = ; chop $a; # Remove the newline at end while ($a ne "fred") { print "sorry. Again? "; $a = ; chop $a; }