nerdexam
IBM

C4040-221 · Question #14

Within a Perl script, how can the output of the hostname command be assigned to a variable called myHostname?

The correct answer is B. chop($myHostname=%hostname -s 2>/dev/nuir). See the full explanation below for the reasoning.

Question

Within a Perl script, how can the output of the hostname command be assigned to a variable called myHostname?

Options

  • AchopfmyHostname-'hostname -s 2>/dev/null")
  • Bchop($myHostname=%hostname -s 2>/dev/nuir);
  • C$myHostname=7usr/bin/hostname".
  • Dchomp(@myHostname-hostname -s 2>/dev/null');

How the community answered

(27 responses)
  • A
    4% (1)
  • B
    74% (20)
  • C
    7% (2)
  • D
    15% (4)

Community Discussion

No community discussion yet for this question.

Full C4040-221 Practice