capture more than one regex matching (oneliner)

2012-03-29 Thread Christian
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

RE: Use of uninitialized value in concatenation (.) or string

2012-03-29 Thread Kronheim, David (Contr)
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

hey need hep on this please

2012-03-29 Thread my
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

Re: hey need hep on this please

2012-03-29 Thread John W. Krahn
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

Re: capture more than one regex matching (oneliner)

2012-03-29 Thread John W. Krahn
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

Re: hey need hep on this please

2012-03-29 Thread lina
#!/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;

Re: hey need hep on this please

2012-03-29 Thread lina
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