on Tue, 14 May 2002 10:35:57 GMT, [EMAIL PROTECTED] (Francesco
Guglielmo) wrote: 

> I have a file with
> 
> username:  name        #there are one or more white space
> 
> I need to make a new file with
> 
> name username

Try this:

    #! perl -w
    use strict;

    while (<DATA>) {
        chomp;
        my @parts = split /:\s+/;
        print "$parts[1] $parts[0]\n" unless @parts != 2;
    }

    __DATA__
    username:  name 
    another:   Firstname Lastname

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to