in reply to printing passwd file
You'll need a plus after print, like this: print+(split(/:/))[0]
(Update: see the beginning of perldoc perlfunc if you don't know why.)
You'll need the perl options and arguments in the shebang line, or make a shell script of this, like
or else#!/bin/sh perl -lne 'print+(split(/:/))[0]' /etc/passwd
or even#!/usr/bin/perl -ln BEGIN{ @ARGV = "/etc/passwd"; } print+(split(/:/))[0]
#!/usr/bin/perl -w @ARGV = "/etc/passwd"; $\ = $/; while(<>) { print+(split(/:/))[0]; }
|
|---|