On Thu, Mar 29, 2012 at 6:08 PM, John W. Krahn wrote:
> my wrote:
>>
>> The goal of this assignment is to put in practice the list and I/O
>> functionalities implemented by Perl.
>>
>>
>>
>> Write a program that will read a list from a file (input), will sort
>> the list in lexical order and write
#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw(open close);
use 5.012;
open my $fh, '<', '/etc/passwd';
open my $fh2, '>', '/tmp/newpasswd';
my $uid;
my %h;
while(<$fh>){
$uid = (split /\:/, $_)[0];
$h{$uid} = $_;
}
print $fh2 map "$h{$_}", sort keys %h;
Christian wrote:
Hi,
Hello,
is there easy way to capture more than one matching and print this
out?
In the example below the first matching is suppressed.
cat file | perl -nle '/p2=(.+)(?=&p3)/&& /p13=(.+)(?=&p14)/&&
print $. . ";" . $1 . ";". $2'
perl -nle'/(?=.*p2=(.+)&p3)(?=.*p13
my wrote:
The goal of this assignment is to put in practice the list and I/O
functionalities implemented by Perl.
Write a program that will read a list from a file (input), will sort
the list in lexical order and write back the sorted list to another
file (output). You can use arrays and any
The goal of this assignment is to put in practice the list and I/O
functionalities implemented by Perl.
Write a program that will read a list from a file (input), will sort
the list in lexical order and write back the sorted list to another
file (output). You can use arrays and any of the Perl
timothy adigun [2teezp...@gmail.com] wrote:
>#!/usr/bin/perl
>use warnings;
>use strict;
>
>my @wanted = qw( dad mum children);
>my @children = qw(tim dan mercy);
>my $ref = {
>dad => "mick",
>mum => "eliz",
>children => { first => 'tim', second => 'dan', third => 'merc
Hi,
is there easy way to capture more than one matching and print this
out?
In the example below the first matching is suppressed.
cat file | perl -nle '/p2=(.+)(?=&p3)/ && /p13=(.+)(?=&p14)/ &&
print $. . ";" . $1 . ";". $2'
Thanks for any help.
Christian
--
To unsubscribe, e-mail: begi