Frank McCollum wrote: > > I have this chunk of code below, where I want to find a file name and add it > to an array called @newFile. Note that only one file will ever match this > search query, so there is no doubt that the right file will be retrieved > (However, they usually prepend the file with a date/time stamp, so I wanted > to be flexible enough to handle this, ergo the string search). > > foreach $_ (glob "*") { > if (/Mortgage\ Market\ Review\ Package/) { > push @newFile, $_; > print "$newFile[0]\n"; > } > } > > ######### > # It just seems that it could be optimized as I have written it in the line > below. I am missing a fundamental point here, because I cannot get it to > work. > #### > > foreach $_ (glob "*") { push @newFile, /Mortgage\ Market\ Review\ Package/}
push @newFile, $_ for glob q(*Mortgage\ Market\ Review\ Package*); John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]