Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Getting and saving IPMI Infos

by Melly (Chaplain)
on Mar 22, 2006 at 09:20 UTC ( [id://538450]=note: print w/replies, xml ) Need Help??


in reply to Getting and saving IPMI Infos

You have three problems in your script

  1. "$tmp=s/\|/\=/,$line;" I've no idea what $tmp and $line will do in this context, but you are neither checking $line nor assigning to $tmp - use =~ if you are not running a regex against $_ - and $tmp is superfluous
  2. You will need to use the 'g' (global) modifier, otherwise you will only change the first occurence of '|'
  3. If you want to get rid of spaces (as you seem to imply), then you will need to include this in your regex
$saved[0] = 'CPU 1 |3000 RPM |ok'; $saved[1] = 'Power Supply |unspecified |cr'; open OUTPUT, ">>ipmiinfo.txt"; foreach $line(@saved){ $line =~ s/\s*\|\s*/\=/g; print OUTPUT "$line\n"; } close OUTPUT;
Tom Melly, tom@tomandlu.co.uk

Replies are listed 'Best First'.
Re^2: Getting and saving IPMI Infos
by theroninwins (Friar) on Mar 22, 2006 at 09:38 UTC
    Thanks for the help. Indeed I want to get rid of the spaces.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://538450]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-20 14:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found