And yes, you get a few "Use of uninitialized value $record1" warnings because of the anomalous third record which has only one filed "A00004" in it. You can safely ignore these warnings or add another test to drop such record if you do not need it.use Modern::Perl; while (<DATA>) { my @record = split; if ($record[1]=~s/-$//) { while (<DATA>) { my ($continuation) = split; $record[1] .= $continuation; last unless $record[1]=~s/-$//; } } say join ' ', @record; } __DATA__ A00002 \\a00002\c$ 2 WinNT NTFS Yes 73,626MB 42.5 A00003 / 1 Linux86 EXT3 No 38,289MB 29.8 A00004 A00004 \Sys- 1 WinNT VSS Yes 0 KB 0.0 temState\- NULL\Syst- em A00005 /xyz 4 Linux86 EXT2 No 12,345MB 30
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: Regex copy and paste help
by CountZero
in thread Regex copy and paste help
by HtorneDK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |