On Thursday 20 April 2006 12:01, John W. Krahn wrote: > Bjørge Solli wrote: > > I have this as a part of my script: > > > > $ncfile = `ls -1 $mersea_cat | head -1`; > > print $ncfile; > > > > It prints the desired first file in $mersea_cat, but _before_ that the ls > > command prints an errormessage to stderr: > > > > ls: write error: Broken pipe > > Why not just do it in Perl without shelling out to use ls and head: > > my $ncfile = substr glob( "$mersea_cat/*" ), length( $mersea_cat ) + 1;
Ah. Of course... Since $mersea_cat = /path/to/filenamestart* to represent all the files starting with filenamestart, this worked fine: $ncfile = glob($mersea_cat); #path and filename is ok. Thankyou very much. Still wondering why that errormessage was printed though, but not very important any more. -- Bjørge Solli - Office:+47 55205847 http://www.nersc.no Nansen Environmental and Remote Sensing Center - Bergen, Norway Dept.: Mohn-Sverdrup Center for Global Ocean Studies and Operational Oceanography -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>