nerdexam
IBM

C4040-227 · Question #218

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

(49 responses)
  • A
    10% (5)
  • B
    82% (40)
  • C
    2% (1)
  • D
    6% (3)

Community Discussion

No community discussion yet for this question.

Full C4040-227 Practice