programming-examples/perl/String/Join strings.pl
2019-11-15 12:59:38 +01:00

12 lines
339 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
my $passwd = "A:B:1:2::/dir:/bin/bash";
my @fields = split /:/, $passwd;
print "Login name : $fields[0]\n";
print "User ID : $fields[2]\n";
print "Home directory : $fields[5]\n";
my $passwd2 = join "#", @fields;
print "Original password : $passwd\n";
print "New password : $passwd2\n";