We apply direct numerical simulation (DNS) of the incompressible Navier-Stokes equations to predict flow through a cylindrical pipe in which a periodic array of orifice plates with a fractal perimeter is mounted. The flow is simulated using a volume penalization immersed boundary method with which the geometric complexity of the orifice plate is represented. Adding a periodic array of orifice plates to a cylindrical pipe is shown to increase the mixing efficiency of the flow in the laminar regime. The average stretching rate is shown to increase by a factor of up to 5, comparing pipe flow without orifice plates to flow passing through an orifice plate derived from the Koch snowflake fractal. The dispersion rate is shown to increase by a factor of up to 4. In laminar flow, the viscous forces are most important close to the walls, causing orifice geometries with the largest perimeter to exhibit the largest axial velocities near the centerline of the pipe and the largest pressure drop to maintain the prescribed volumetric flow rate. The immersed boundary method is also applied to turbulent flow through a 'fractal-orifices pipe' at Re = 4300. It is shown that the pressure drop that is required to maintain the specified volumetric flow rate decreases by about 15% on comparing orifice plates with a circular opening to orifice plates with more complex shapes that contain several corners such as triangles, squares, stars and the Koch snowflake.