in reply to extracting data from a line

perl -ne'@a=split /\//; print pop @a'

Cheers,
R.

Replies are listed 'Best First'.
Re^2: extracting data from a line
by TedPride (Priest) on Oct 22, 2004 at 17:03 UTC
    #! perl -w open(MYOUTFILE, ">/tmp/design_name_bot"); open (FILEH, "/tmp/strfile"); $_ = <FILEH>; print MYOUTFILE substr($_, rindex($_, '/') +1); close(FILEH); close(MYOUTFILE);
    Substr is the most efficient method, and he specified a one line file.

      TedPride++ I had not thought of the substr($_, rindex($_, '/') +1) way to get the last 'element' off a line and this is something I find I am coding a lot here. Its always nice to learn a more efficient way to do things.

      Thanks,
      R.