Johnson, Reginald (GTI) wrote: > > From: John W. Krahn [mailto:[EMAIL PROTECTED] >> >> Johnson, Reginald (GTI) wrote: >>> >>> foreach $bkline (@bkupArray) { >>> my >>> ($bkup_node_ora,$bkup_db,$bk_blank,$id,$type,$cap,$start,$filler,$filler2,$filler3,$filler4,$bk_end,$rest)= >>> split (/,/,$bkline); >>> my ($bkup_node) = split(/_/,$bkup_node_ora); >>> >>> [ snip ] >> >> my @bkupArray; >> while ( <LASTBKUPFILE> ) { >> # Only need to store three fields from >> '/adsm/CRONJOBS/RMAN/lastbkup_temp' >> push @bkupArray, [ /^([^_]+)/, ( split /,/ )[ 1, 11 ] ]; >> } >> >> [ snip] > > Can you interpet to my how the regular expression in the code works. > push @bkupArray, [ /^([^_]+)/, ( split /,/ )[ 1, 11 ] ]; > > I understand the slice getting 1 and 11th element but don't get how the > regular expression works.
The regular expression says to match starting at the beginning of the line one or more non-'_' characters and because of the list context the contents of the capturing parentheses are returned and become the first element of the anonymous array. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/