Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming language concept - T Please let me know if you need more time. Thank

ID: 648271 • Letter: P

Question

Programming language concept - T

Please let me know if you need more time. Thanks.

The following grammar describes the syntax of hexadecimal integer constants in D. Write a single Perl pattern that matches the strings that can be derived from . Simplify your pattern as much as possible.

                               | <long-suffix> [ <unsigned-suffix> ]

|a|b|c|d|e|f|A|B|C|D|E|F

Programming language concept - T Please let me know if you need more time. Thanks. The following grammar describes the syntax of hexadecimal integer constants in D. Write a single Perl pattern that matches the strings that can be derived from . Simplify your pattern as much as possible.

Explanation / Answer

#!/usr/bin/perl # # Print the time (possibly the mtime of a file) as a hexadecimal integer # If more than one file, print the mtime of the *newest* file. # undef $now; foreach $file ( @ARGV ) { ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, $ctime,$blksize,$blocks) = stat($file); if ( !defined($now) || $now < $mtime ) { $now = $mtime; } } if ( !defined($now) ) { $now = time; } printf "0x%08x ", $now;